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

Answered
Split one image into multiple images
Assuming you have the Image Processing Toolbox, image = [ 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

4 years ago | 1

| accepted

Answered
Weird problem in while loop: What is wrong with the input "48" compared to "47" and "49"????
It's because 48 is the ASCII code for '0'. double('0') char(48) 48=='0'

4 years ago | 2

| accepted

Answered
Difficulty fitting translation and rotation between two matrices of coordinate points
This FEX download handles your posted data pretty well, https://www.mathworks.com/matlabcentral/fileexchange/26186-absolute-ori...

4 years ago | 1

| accepted

Answered
curve fitting in MATLAB by using curve fitting tool
The centering/scaling means the xdata,ydata will be pre-normalized before any fitting is done. The doc is not specific about wha...

4 years ago | 1

| accepted

Answered
Solve system of equations depending on other syms variables
Plus I need to specify the variables to eliminate and not the ones that the solution should depend on. Just because you are abl...

4 years ago | 0

Answered
Solve system of equations depending on other syms variables
This version solve(eqns, [x,z]) is correct because it communicates to solve() that x is not a constant. With solve(eqns, z), th...

4 years ago | 0

| accepted

Answered
How can I use fzero on these two functions?
If you are going to transform the function, you must restrict the search to the domain where the transform is valid, f=@(x) log...

4 years ago | 0

Answered
Estimation of variables from the inequality and equality constraints
Since there are only 3 variables, you can do a discrete sweep of the bounded box described by lb, ub to find points that satisfy...

4 years ago | 0

Answered
String with mask parameter
For example, "item" + (0:3)' + "/" + ["pump1" "pump2" "cold_valve" "hot_valve"]

4 years ago | 0

| accepted

Load more