Answered
Finding radius of sphere and circle
The code should look more like this, function [radcircle,radsphere]=calculations(areaCircle,volumeSphere) radCircle=sqrt(ar...

5 years ago | 0

Answered
How to reconstruct 3D volume from 2D projections that are generated by same 3D volumetric?
I fyou mean you need to implement your own forward projector, a simple (and not terribly fast) implementation would be with imro...

5 years ago | 0

Answered
How can I draw without replacement?
S=[1,2,3,4,5,6,7,8,9,10,0,0,0,0,0,0,0, 0,0,0]; [~,is1]=sort(rand(30,20),2); [~,is2]=sort(rand(30,20),2); result=S([is...

5 years ago | 0

| accepted

Answered
5x5 matrix (P) with all 25 values unknown. I have two known matrices of size 5x5 each (A1 and A2) and the relation P*A1*inv(P)=A2. How do I obtain P?
A necessary but not sufficient condition for a solution is A2*P-P*A1=0, which is equivalent to K*P(:)=0 where K=kron(I,A2)-kron...

5 years ago | 1

| accepted

Answered
About Adding Lines to Your startup.m file
The startup.m file is not a file that ships with Matlab. It needs to be created by you. You can put it anywhere in your permanen...

5 years ago | 0

Answered
How to judge the relatively stable section in the curve
One possibility might be to look at the local span seminorm (max-min) over a sliding window. window=50; lookahead = movmax(cu...

5 years ago | 0

Answered
Is it possible to reconstruct an image from the number of pixel counts and bins information?
As Walter has shown, it is not an invertible mapping, however, if you use histcounts() instead, there is enough information for ...

5 years ago | 1

Answered
how to find total combination of 5 elements in composition?
Here's an old routine from John D'Errico. I can't find it on the File Exchange anymore, for some reason. combinations=diophanti...

5 years ago | 0

| accepted

Answered
How to remove rows in a nested for loop?
It should start with the column (and therefore the Detected_center point) with the overall shortest distance to a Original_cent...

5 years ago | 1

| accepted

Answered
Efficient matrix multiplication with weights
A more memory efficient solution is as follows. It has a loop, but is still highly vectorized. Wt=W.'; At=A.'; T=toeplitz(1:N...

5 years ago | 0

| accepted

Answered
Is applying a binary operator (+,-,*,/) to char arrays supported by MATLAB or just a "trick"
I can't find the documentation, but binary operators in Matlab can't define themselves. It had to be deliberate. Also, the char...

5 years ago | 0

Answered
Efficient matrix multiplication with weights
Using sepblockfun() from, https://www.mathworks.com/matlabcentral/fileexchange/48089-separable-block-wise-operations T=toepli...

5 years ago | 0

Answered
Losing pixels with imrotate
So my question was: is there any other way to rotate the images without losing pixels? If you use 'linear' or 'cubic' interpol...

5 years ago | 0

| accepted

Answered
Calculate average between min and max numbers in column 3 depending on values in column 2, for each value in column 1
A=yourMatrix; idx=A(:,1)==7; B=A(idx,:); [~,idx]=maxk(B(:,2),5); C=B(idx,3); result=0.5*(max(C)+min(C))

5 years ago | 1

| accepted

Answered
Iteratively fill structure with custom class objects
I'm puzzled as to why your custom_class() constructor requires the same input argument twice, but this is how I'd do it. rows =...

5 years ago | 0

Answered
What's the inverse of squeeze?
A=reshape(A,128,1,514)

5 years ago | 0

| accepted

Answered
Count the number of times a value repeats between certain rows in a matrix.
A=[2,5,15,65,102; 2,65,1,105,55; 65,104,15,19,5]; skip=1; A1=A(1:end-skip,:); A2=A(skip+1:end,:); M=size(...

5 years ago | 0

| accepted

Answered
How to write an optimization constraint related to neighbors of a node in a graph
You can get the graph adjacency matrix A from the adjacency() command, https://www.mathworks.com/help/matlab/ref/graph.adjacenc...

5 years ago | 0

| accepted

Answered
Complex non-linear least squares fitting of impedance data
Because your model function is linear with respect to x(1) and 1/x(2), it would be beneficial to download fminspleas, https://w...

5 years ago | 0

Answered
random matrix with a minimum number difference for adjacent numbers accepted
Why not as follows? min_diff=0.1; R=rand(1,6); R=R./min(abs(diff(R)))*min_diff; abs(diff(R))

5 years ago | 0

Answered
I need to change the frequency domain of a DFT
stem(2*pi*f,abs(shx),'r')

5 years ago | 1

| accepted

Answered
Read sparse matrix from notepad
S=spconvert(load('S_sp.txt'))

5 years ago | 0

| accepted

Answered
Count number of rows in a matrix based on frequency of one element and value of another element
nnz( matrix(:,1) == 10 & matrix(:,2) > 5 );

5 years ago | 0

| accepted

Answered
How to improve calculation time for a huge matrix?
When speed matters, avoid symbolic math. Also, download https://www.mathworks.com/matlabcentral/fileexchange/74956-ndgridvecs ...

5 years ago | 0

Answered
How to remove rows in a nested for loop?
For Euclidean distance, discard=any( pdist2(Original_center,Detected_center)<Threshold ,2); Original_center(discard,:)=[];...

5 years ago | 0

Answered
Creating a inclined plane with an adjustable dome pattern cutout of it.
You can rotate and replicate the single dome using hgtransform, similar to this example, https://www.mathworks.com/help/matlab/...

5 years ago | 0

Question


Height of a figure spontaneously changes.
When I run the following code, I find that the OuterPosition properties of both figures report the same height and width, as exp...

5 years ago | 2 answers | 0

2

answers

Answered
Coloring axis with gradients?
Do you mean colorbar()?

5 years ago | 0

Answered
Integral of the product of integrals
I=@(y,f) integral( @(x)f(x,y), a, b); I123=@(y) I(y,f1) .* I(y,f2) .* I(y,f3); integral(I123, c, d)

5 years ago | 0

| accepted

Answered
How can I find the distance between adjacent blobs in a segmented image?
Here's one way. mask=imclose(mask, strel('disk',12) ); imshow(mask) blobProps = regionprops( mask , 'Centroid'); blob...

5 years ago | 0

Load more