Answered
Most efficient way to find the indices of rectangular annuli in a 2D matrix
I=[ones(1,50), 2*ones(1,50), 3*ones(1,100)]; I=[I,flip(I)]; pink = (I==3 & I.'==3); green = (I>=2) & (I.'>=2)&~pink; yel...

6 years ago | 0

| accepted

Answered
Create a program displaying number of numbers greater than 0.8 in matrix
A=rand(5,6) for row=1:5 for col=1:6 result=nnz(A>0.8); end end

6 years ago | 0

| accepted

Answered
How to select a column with a specific value of interest and include it into equations.
f=@(t) sqrt(t-t.^2); theta=acos(1-2*s); G=alpha*Vinfinity*diff(theta+2*f(s));

6 years ago | 0

Answered
Basic math operations on contents of a cell array
Is there any reason why basic math operations don't work with cell arrays? Seems to me it would extremely useful and efficient ...

6 years ago | 1

| accepted

Answered
How do I call upon a function in another function?
You request an output from getPhase() here, Output=getPhrase(); but your implementation of getPhrase() does not return any out...

6 years ago | 0

Answered
matlab strange result for mean of single vs double
This is fine as workaround...mean(mean(mean(a,2),3),4) Another workaround is to force the mean calculation in double type, a=s...

6 years ago | 1

Answered
How to calculate centerline of 3D image
You can use bwskel, https://www.mathworks.com/help/images/ref/bwskel.html

6 years ago | 0

Answered
Saving Specific Figure Handle For Recovery After Plotting Many Figures
When you open a figure or axis you can save a handle to it, e.g., h(1)=figure(1); h(2)=figure(2); ... You can later use whic...

6 years ago | 1

| accepted

Answered
Quasi newton method for NLP code problem
Is there any built in function to solve PRSopt_QN with quasi-newton ? Yes, fminunc is a quasi-newton solver, https://www.math...

6 years ago | 0

| accepted

Answered
Approximating Definite Integrals as Sums
I don't know what gaussian meshes are, but the Riemann sum works with a just few fixes to the way the sampling is set up: NBZ =...

6 years ago | 1

| accepted

Answered
how to call out specific cell in a matrix
S=A+B; for i=1:length(S) if S(i)<C(i) ... end end

6 years ago | 0

| accepted

Answered
Keeping the indexed matrix the same shape as its index
Why does f(index) get transposed exclusively when f contains three variables? It is not exclusive to f having three elements. ...

6 years ago | 0

Answered
Is there any log-scale for symbolic functions?
This also seems to work, as long as you don't care whether your plot line is of type Line or FunctionLine figure(2); h=fplot(...

6 years ago | 1

Answered
Strange results using Curve Fitting tool
Not many, since without your data and code, we cannot reproduce what you are seeing. One possible culprit though is the initial ...

6 years ago | 1

Answered
Fmincon objective and nlcon shared simulink parameters
function [x,f,eflag,outpt] = runobjconstr(x0,opts) if nargin == 1 % No options supplied opts = []; end simulation_pa...

6 years ago | 0

| accepted

Answered
the 'fmincon' optimisation doesn't stop at minimum with all possible algorithms
Change the units of your unknowns to a less extreme order of magnitude. Also, fmincon is way overkill for a 1D problem. Use fmin...

6 years ago | 0

| accepted

Answered
Termination Conditions fmincon: Optimality
In the constrained case, the first order optimality metric, described here, https://www.mathworks.com/help/optim/ug/first-order...

6 years ago | 0

| accepted

Answered
Solving "transposed" Lyapunov equation AX+X'B=Q
I don't know how large your system is, but if not super-large you could use func2mat, https://www.mathworks.com/matlabcentral/f...

6 years ago | 0

Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent.
Well, for example dXadt is 1x2 and dXedt is 1x1, so you cannot stack them on top of each other to form a new matrix. dXadt ...

6 years ago | 0

Answered
Rowfun and sum of array elements based on start and stop position from another array
It works with loops but the size of my table makes it quite slow It shouldn't be. Even with several thousand table columns, a l...

6 years ago | 0

| accepted

Answered
Rowfun and sum of array elements based on start and stop position from another array
So, how to achieve that simple operation with rowfun? I don't see rowfun as being part of the solution. Just pull the values ou...

6 years ago | 0

Answered
Compatible Problem in Matlab: LineSearchType option is no longer valid in using optimset
options = optimset('LargeScale', 'off', 'HessUpdate', 'dfp','MaxFunEvals', MaxFunEvals, ... 'display', 'of...

6 years ago | 0

Answered
Rotation of an xy coordinate system
Looks fine to me. When you rotate about the origin, the only point that stays fixed is the origin.

6 years ago | 0

| accepted

Answered
How can I convert 100 X Y and Z coordinates generated randomly in the form of a 100x100x100 matrix
If you mean you want a 100x100x100 binary array A with one hundred randomly located entries where A(i,jk)=1, then A=false(100...

6 years ago | 0

| accepted

Answered
Error using fmincon MATLAB function
Because of the discontinuity at x1=0 and x2=0, you need to optimize over each quadrant separately. s=[+1,+1; %quadrant signs ...

6 years ago | 0

| accepted

Answered
Mean Variance portfolio selection with l1-norm
Sure. Minimizing a quadratic subject to linear constraints is exactly what quadprog is for.

6 years ago | 0

Answered
How to perform image registration on GPU
If you only need to register translation, you can use normxcorr2() which is GPU-supported https://www.mathworks.com/help/images...

6 years ago | 0

Answered
how to find coordinates of each brick corners using matlab
After applying imopen() like ImageAnalyst recommends, you could download pgonCorners and apply it as in this example in this exa...

6 years ago | 0

Answered
What is wrong with my for loop?
It seems clear that when i=j, the left hand side of K((j*s-j-1):(i*s-i-1), (j*s-j-1):(i*s-i-1)) = k(1:s,1:s); will be 1x1 wher...

6 years ago | 1

Load more