Answered
How to substract every two adjacent column from a matrix
y=(x(:,3:N)-x(:,1:N-2))./x(:,2:N-1);

6 years ago | 0

| accepted

Answered
Which equation does Matlab use to fit a Normal distribution?
To reverse engineer, we can fit the following data x=randn(1e5,1)*2+5; which is definitely distributed according to the first ...

6 years ago | 1

| accepted

Answered
fftfilt function inputs and output
The time domain.

6 years ago | 0

Answered
How origin is moved to the centroid of an image
newImage = imtranslate(oldImage,[134,235] - [155,250])

6 years ago | 0

| accepted

Answered
How do i rotate a 3D vector along the psi, theta, and phi axis being the x,y,z axis?
Using AxelRot from the FIle Exchange https://www.mathworks.com/matlabcentral/fileexchange/30864-3d-rotation-about-shifted-axis?...

6 years ago | 0

Answered
Modify a surface within a class
You already have a class property reserved for the surface handle, but you are not using it. Simply do, obj.surface = surf(X,Y,...

6 years ago | 0

| accepted

Answered
How origin is moved to the centroid of an image
The image coordinate system is not something that is given to you, and that you have to "move". It is something you create using...

6 years ago | 0

Answered
Fitting a 3D gaussian to a 3D matrix
You can also use gaussfitn, https://www.mathworks.com/matlabcentral/fileexchange/69116-gaussfitn [xx,yy,zz]=meshgrid(x,y,z); ...

6 years ago | 0

Answered
Generate random integers that sums to a specific number within a specific range
Quite similar to what randfixsum(Random Vectors with Fixed Sum) could achieve, but I am having trouble limiting the generated va...

6 years ago | 0

| accepted

Answered
Generate random integers that sums to a specific number within a specific range
For such a small problem size, you can pre-generate a table of allowable combinations: [x,y]=ndgrid(uint16(100:700)); z=1000...

6 years ago | 1

Answered
How to get image back in M*N*3 form? how to divided my image 1200*1000 into 8*8 Blocks without using mat2cell?
Using mat2tiles (Download), im1=rand(1200,1000,3); tiles=mat2tiles(im1,[8,8,3]); sz=size(tiles); im_b=cat(3,tiles{:});...

6 years ago | 0

Answered
Inverse of higher order matrix
I have system of equations xQ = 0 and xe =1 where 'e' is a column vector of appropriate dimension, x is a row vector of size (1,...

6 years ago | 0

Answered
How to find width at certain pixel value in an image
Use the edge() command. Then, for each desired x-position, take the y-position of the 3rd edge from the top.

6 years ago | 0

| accepted

Answered
How to improve the fitting result
Discard the data corresponding to data_x>2.98. Clearly, you do not want that to participate in the fit.

6 years ago | 0

Answered
Logical indexing in multidimensional array
T=reshape(res,[],16); T(T(:,9)>5,4:16)=nan; res=reshape(T,size(res));

6 years ago | 1

Answered
How to force fsolve to perform one iterations?
There is no way you can force fsolve to progress if x0 is already an ideal solution. In that case, there would be nowhere to pro...

6 years ago | 0

Answered
NEED CODE of MULTI OBJECTIVE PARTICLE SWARM OPTIMIZATION FOR CONSTRAINED PROBLEM
This is where code offerings can be found, https://www.mathworks.com/matlabcentral/fileexchange/

6 years ago | 1

Answered
Indexing with intercept for repeating values
a = [1;1;1;2;3;3;4;5;6;7]; b = [1;1;1;1;1;2;3;4;4;4;5;6;7;7]; c = splitapply(@(x){(1:numel(x)).'<=sum(a==x(1))} , b , findgr...

6 years ago | 0

| accepted

Answered
Too many output arguments help
Your function needs to be told what to return, e.g., function ColorIdent = ColorID(~)

6 years ago | 1

| accepted

Answered
Is there a way to define a new built-in function?
I'm under the vague impression that you are unaware of the Matlab path and how it allows you to keep your mfiles in one place wh...

6 years ago | 1

| accepted

Answered
Bug in the parse, inputParser family of functions?
Note that the only difference between the first and second call to "myParse" is the order of the arguements. If the order is no...

6 years ago | 0

| accepted

Answered
linear programming solution found unbounded but is bounded
Note, Wolfram's alpha has a tool that solves it No, the Wolfram tool finds it to be unbounded as well. Are there supposed to b...

6 years ago | 1

| accepted

Answered
Linear System Speed Up Ax=b
the coefficient matrices are so sparse in this case and I think that there may be ways that we can exploit this If those matric...

6 years ago | 1

| accepted

Answered
Establishment of vectors in 2D coordinate system based on 2D image
load image T=bwferet(B); C=cell2mat(T.MaxCoordinates); X1=C(1:2:end,1); Y1=C(1:2:end,2); X2=C(2:2:end,1); Y2=C(2:2:end,2); ...

6 years ago | 0

| accepted

Answered
How to find the matrix that minimizes a certain objective function, with complex constraints?
Convert this to an unconstrained problem with the change of variables X=B+Z'*Z and then use fminunc, M3=M2+B; fun = @(Z) -no...

6 years ago | 0

| accepted

Answered
How to plot multiple cubes if I know the x,y,z centroids and dimension
You can use plotregion from the File Exchange, https://www.mathworks.com/matlabcentral/fileexchange/9261-plot-2d-3d-region lb=...

6 years ago | 0

| accepted

Answered
How to filter/smooth an image that has circular symmetry?
One approach would be to use radon and iradon, noisyImage= (1+sqrt((-100:100).^2 + (-100:100).'.^2)); noisyImage=noisyImage.*(...

6 years ago | 1

| accepted

Answered
How to create a loop to create iterations of all possible combinations of two columns, from two different matrices?
for i=1:3 for j=1:3 yourFunction(a(:,i), b(:,j)) end end

6 years ago | 0

Answered
How to create a loop to create iterations of all possible combinations of two columns, from two different matrices?
[I,J]=ndgrid(1:3); Combinations = reshape( [a(:,I);b(:,J)] , [],2, 9); for i=1:9 yourFunction( Combinati...

6 years ago | 0

Answered
Identify Individual Shape from Matrix Representing Multiple Shapes
You could make a binary image B of the box and a label matrix L of the shapes. Then the label index i of the intersected shape i...

6 years ago | 0

| accepted

Load more