Answered
Splitting Matrix based on another matrix
This might be what you want. popx=[52.647 10.912 2.389 52.564 10.911 2.389 52.569 10.912 2.389 52.569 10.912 2.3...

4 years ago | 0

Answered
how to resize image 3D
Use imresize3.

4 years ago | 0

| accepted

Answered
Simultaneous lsqcurvefit for data set with shared parameters
I don't know if this was the solution you were expecting. The residuals don't look too bad, especially for such a small amount o...

4 years ago | 0

| accepted

Answered
Is there a way to pass a function handle as an argument for fsolve command?
F is already a function handle, so the call should be something like, F = @(y) [y(2); (R*omega^2/l)*cos(y(1) - omega*t) - (g/l...

4 years ago | 0

Answered
Convex set: Finding the A and b matrices from Ax=b when the points of the convex set is known.
Make a change of variables in the problem by rewriting x in terms of an unknown vector of coefficients where ...

4 years ago | 0

Answered
How does MATLAB allocate memory while solving large (10m-ish) linear systems?
With 5m variables and a density of 0.01%, your matrix is going to consume about 56GB even before mldivide starts to do any work...

4 years ago | 0

| accepted

Answered
Calculating exponentials using only addition?
Hint: first build a function that implements multiplication. Then use recursion, noting that a.^n is the same as a*a^(n-1).

4 years ago | 0

Answered
Cumulative sum between two trues in array according to positions stored in logical array
v=[0;1;2;0;2;4;5;6;2;3;4]; pos=[true;false;true;false;false;true;false;true;false;false;true]; cv=cumsum(v); I=find(pos); ...

4 years ago | 0

| accepted

Answered
how to solve polygon subtract problem?
Express the 2 regions as a polyshape vector: p1=nsidedpoly(1000); p2=nsidedpoly(1000,'Center',[1,0]); p3=subtract(p1,p2); p4...

4 years ago | 0

Answered
how to solve polygon subtract problem?
but what i want to plot is thrid polygon. Plot the original polygon overlaid on top of the crescent (moon), but make the origin...

4 years ago | 0

| accepted

Answered
fmincon optimizes a non-differentiable function, How?
But I am unable to understand how the optimality criterion gets satisfed given that the function is non-differentiable at and t...

4 years ago | 0

| accepted

Answered
How to use switch statement
No, do it like this: [lettergrade] = curvedGrade(71,[90,80,70,60, 50]) function [lettergrade] = curvedGrade(grade,bound) ...

4 years ago | 0

| accepted

Answered
Efficient multiplication by large structured matrix of ones and zeros
It may seem counter-intuitive that this version is faster than the versions in my earlier comment, since it does twice as much s...

4 years ago | 2

| accepted

Answered
How do I convert multiple discontinuous lines into a single polyshape?
Using this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/74010-getcontourlinecoordinates?s_tid=ta_fx_resul...

4 years ago | 1

| accepted

Answered
Using fmincon to maximize a complex scalar function
It is because your objective is returning a complex value at phi0. >> obj(phi0) ans = 1.3978 + 1.8395i

4 years ago | 0

Answered
How to extract property values from an object array and put it into a new array?
% Changing the name of each objects property x1.Name = 'test1'; x2.Name = 'test2'; x3.Name = 'test3'; x4.Name = 'test4'; li...

4 years ago | 1

| accepted

Answered
Is there a function in MATLAB to calculate higher DCTs like DCT-III, IV etc?
You can check the File Exchange, e.g., https://www.mathworks.com/matlabcentral/fileexchange/24050-multidimensional-discrete-cos...

4 years ago | 0

| accepted

Answered
Is there a function in MATLAB to calculate higher DCTs like DCT-III, IV etc?
I don't think so, but you can always build one from fft(). function Y=dctn(X) d=size(X); n=numel(d); subs0=rep...

4 years ago | 0

Answered
Using Interp 2 to regrid multiple sets of Lat Long data
Your SLvLong data are non-monotonic. >> SLvLong(270:280) ans = 269.0615 270.0265 270.9909 271.9549 270.7897...

4 years ago | 0

| accepted

Answered
How to find an index of an object from object array?
One way: d1.Name = 'data1'; d2.Name = 'data2'; d3.Name = 'data3'; d4.Name = 'data4'; d5.Name = 'data5'; d6.Name = 'data6';...

4 years ago | 0

| accepted

Answered
How to simplify that?
i=4; any(mod(i,[2,3,7,11])==0)

4 years ago | 0

| accepted

Answered
Count number of cells separating two trues in logical vector
x=[true;false;false;false;true;false;false;true;false;true]; diff(find(x))

4 years ago | 1

| accepted

Answered
concatenate 2 vectors as string
Why not as a string array? a = [87.46 85.38 85.99 85.49 88.56 85.67]; b = [0.16 1.97 2.38 2.38 1.63 1.81]; c=a+string(char(...

4 years ago | 1

| accepted

Answered
Perpendicular Points on Splines
I hope this is understandbale in any way. A figure might help. Regardless, though, you should probably use pdist2 to find neare...

4 years ago | 0

Answered
lsqcurvefit Jacobian returns a scalar
Check your calling syntax. [x,resnorm,~,~,~,~,jacobian] = lsqcurvefit(F,x0,f,y,lb,ub,options);

4 years ago | 0

| accepted

Answered
How do I write a function for fmincon using a for loop?
Forget the loop. Also, use lsqcurvefit instead: params0=[lambda0(1), lambda0(1)-lambda0(2) ]; %re-parametrize [params, si...

4 years ago | 0

Answered
how to filter out the line that intersects with another line?
You can use intersectionHull from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/30892-analyze-n-dimen...

4 years ago | 0

| accepted

Answered
Curve fitting to data using fit
x=[100; 85.4019292604501; 77.9310344827586; 79.3365583966828; 70.3524533; 13.213644524237; 24.5654917953199; 12.65263402...

4 years ago | 0

| accepted

Answered
Give gradient to fmincon
If the problem is constrained, the gradient in a local extremum usually is not 0. In fact, if the gradient is non-negative on t...

4 years ago | 0

| accepted

Load more