Answered
Loop in a cell array that consist of matrices in each cell
You have a variable called "max" previously defined in your workspace.

5 years ago | 0

Answered
I would like a function to remove the duplicate values, but one that removes the duplicate value as well.
USing the functions in https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-...

5 years ago | 0

| accepted

Answered
fminunc crashes matlab if large number of input variables used
Well, the practice you have of cumulatively nesting anonymous functions inside one another is asking for trouble. You should at ...

5 years ago | 1

| accepted

Answered
How to apply logical matrix to the matrix with array operation?
Matrix = [ 3 4; 5 6]; Logical= [ 1 1 ; 0 0]; R=Logical.*Matrix

5 years ago | 0

| accepted

Answered
How to substitute one value in vector by vector?
x=[-1 1 -1 1]; X=kron(-x,[1,2,3]); X=X+4*(X<0)

5 years ago | 0

Answered
How to substitute one value in vector by vector?
x=[-1 1 -1 1]; x=strrep(10*x,10,[3,2,1]); x=strrep(x,-10,[1,2,3])

5 years ago | 0

Answered
why the caculation results is different for parfor-loop and for-loop?
Probably because, with a parpool active, the matrix multiplication code cannot multithread the operation in precisely the same w...

5 years ago | 1

Answered
Is there any exmaple on how to apply fmincon function to a state space optimisation problem?
These should be applicable, https://www.mathworks.com/help/optim/ug/fit-ode-problem-based-least-squares.html https://www.mathw...

5 years ago | 0

Answered
How to substitute one value in vector by vector?
x=[-1 1 -1 1]; i=(x+3)/2; V=[1 2 3;3 2 1].'; X=reshape( V(:,i) ,1,[])

5 years ago | 0

Answered
How to substitute one value in vector by vector?
x=[-1 1 -1 1]; idx=(x==1); X=nan(3,numel(x)); X(1,idx)=3; X(2,idx)=2; X(3,idx)=1; X(:,~idx)=4-X(:,idx); X=X(:)....

5 years ago | 0

Answered
Calculation of Hessian matrix in gamultiobj hybrid function
If you mean that you can't compute the Hessian yourself and wish to do so using finite difference approximations then https://w...

5 years ago | 0

Answered
Finding the average of the neighbors of each pixel in an image
mean4=conv2(image,[0 1 0; 1 1 1; 0 1 0]/5,'same'); mean8=conv2(image,ones(3)/9,'same');

5 years ago | 1

Answered
Issue while fitting semi-circle on a set of points
See incircle() in https://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects?s_tid=srchtitl...

5 years ago | 0

Answered
Issue while fitting semi-circle on a set of points
I recommend circularFit from https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-tools-for-fitting-conic...

5 years ago | 0

| accepted

Answered
Using a loop to impose specific values
For example, x=linspace(-1,1,1000); plot(x,twoparts(x)) function y=twoparts(x) y=abs(x); region=x>0; y(region)=x...

5 years ago | 0

Answered
combining results into a single matrix
One way. h = [1 2 3 4 5]; n=numel(h); m=n-2; First_Matrix=toeplitz([1,zeros(1,m-1)] ,[1 1 1 zeros(1,n-3)]).*h

5 years ago | 0

| accepted

Answered
How do a cell2mat conversion for a non-uniform cell to a matrix
cell2mat(DD(:))

5 years ago | 0

Answered
how to fix subplot images
subplot(4,5,ii-15)

5 years ago | 0

| accepted

Answered
How to make a variable negative if another variable is negative?
X1=X.*sign(Y);

5 years ago | 0

| accepted

Answered
Intersection of two lines
You need a least squares solution, since lines in 3D do not generally intersect. Assuming your point data are in column-vector f...

5 years ago | 0

| accepted

Answered
Plotting the solutions of an equation (rotated ellipsoid)
If you have the center, radii, and yaw-pitch-roll angles (in degrees) of the ellipsoid, you can plot a data-free ellipsoidalFit ...

5 years ago | 1

Answered
I dont understand why my table is displaying 1x1 sym and not a numerical value
You seem to be under the impression that vpa() converts a sym to a number. What you really want to do is use matlabFunction() to...

5 years ago | 0

| accepted

Answered
How can I create a set of N diagnal matrices range from diag(1, 1, ... , 1) to diag(-1, -1, ... , -1) for testing purposes?
Do you really need all Z{i} at the same time? [C{1:N}]=ndgrid([-1,1]); C=reshape( cat(N+1,C{:}) ,[],N); Z=zeros(N^2,2^N); ...

5 years ago | 1

| accepted

Answered
Non-linear constraints with several input variables in fmincon
Your nonlinear constraints are not differentiable. That doesn't always spell disaster, but it breaks the assumptions of fmincon....

5 years ago | 0

| accepted

Answered
fsolve, fmincon producing different results
Do they both achieve the same objective value? If so, you simply have multiple solutions.

5 years ago | 0

Answered
How to extract columns from multiple 3D arrays?
Seems like you could just put them in a matrix: F=[f1(:), f2(:),f3(:),...,f7(:)]

5 years ago | 0

| accepted

Answered
How to Solve matrix equations in Matlab
With an over-determined system (3 equations and only 2 unknowns), you can't expect an exact solution. However, the solution that...

5 years ago | 1

| accepted

Answered
Efficiently assigning class property in a quadruple loop?
You've not told us the dependence of myLogicalVector and someFixedValue* on the loop variables, which is probably super-importa...

5 years ago | 0

Answered
Double Summation without using fft2 function
You can find examples of for-loop construction here, https://www.mathworks.com/help/matlab/ref/for.html#buhafgy-3

5 years ago | 0

| accepted

Load more