Answered
fsolve no solution found results
Is the output the last iteration or does it output the initial conditions? It is the last iteration, as you can easily test, .e...

3 years ago | 0

| accepted

Answered
fmincon sometimes returns "incorrect number of elements of objective gradient" error.
My best guess is that the MaxFunctionEvaluations limit was reached midway through finite differencing operations needed to compl...

3 years ago | 0

Answered
non linear regression problem. fitnlm gives error
Your model function can easily generate NaN's and Infs because with fitnlm there is nothing to bound the b parameters (see below...

3 years ago | 0

Answered
Defining normal unit vector for arbitrary plane surface in 3D space
Use planarFit() in this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-tools-for-fitt...

3 years ago | 0

Answered
How can i get the smallest shape using a list of centroid coordinates?
You can use bwalphaclose from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/90762-further-tools-for-a...

3 years ago | 0

| accepted

Answered
Plotting the vertex based hexagon hierarchical structure.
P=rotate(nsidedpoly(6,'SideLength',1),30); %1 hexagon plot(P,'FaceColor','none'); axis equal P=fcopy(P,sqrt(3)*[1,0], 0:7 ...

3 years ago | 0

Answered
Creating 3D efficiency map using interpolation.
torque=torgue; F=scatteredInterpolant(speed(:),torque(:), efficiency(:)) Now use F to query the points you want as explained...

3 years ago | 1

Answered
Finding a set of easily distinguishable local minima quickly and algorithmically.
load matlab y=im_mean(:); x=(1:numel(y)).'; k=(y==movmin(y,21)); plot(x,y,'-', x(k),y(k),'ro'); legend('Signal','Local...

3 years ago | 0

Answered
How to plot an in-ellipse(ellipse inside an object) which also matches the object orientation.
a=5; b=3; %axes lengths theta=40; %rotation angle x0=1;y0=2; %center fcn=@(p) translate( rotate( scale(p,[a,b]), theta),...

3 years ago | 1

| accepted

Answered
Trouble using Curve Fitter tool
I am not sure I understand what you mean regarding apparent singularities in my x,y data. If beta+k2*x=0 or delta+k4*x=0 then y...

3 years ago | 0

Answered
fmincon non-linear optimisation: issues with sqp and interior-point
SQP...Basically, it lacks the tools to make a step back when overshoots On the contrary, it is one of the few algorithms that c...

3 years ago | 0

| accepted

Answered
How to find the value in one column based on a value of a another column.
% Generate example data time = (0:0.1:1)'; pressureA = 20*sin(time/3); pressureB = 20*sin(pi*time/4); pressureC = 20*sin(p...

3 years ago | 0

Answered
fitting data with a combination of exponential and linear form ( a*exp(-x/b)+c*x+d )
If you download fminspleas, you can get a pretty good fit with a fairly naive initial guess [b,e,f]=[-1,0,0]: [x,y]=readvars('d...

3 years ago | 2

Answered
How can I use datacursormode in app designer?
Yes, it's an unfortunate deficiency, and one of the main reasons I'm still using GUIDE. One workaround is to make an additional ...

3 years ago | 0

Answered
How can I fit a curve at the bottom of the plot below?
You can use boundary, y=readmatrix('data.txt'); x=(1:numel(y))'; k=boundary(x([1:end,1]), y([1:end,1])); k=k(diff(k)>0); ...

3 years ago | 1

| accepted

Answered
Cutting everything above an intersection of two elipses
Just use min(). Example: x=linspace(-3,3); y1=(x-1).^2; y2=(x+1).^2; figure; plot(x,y1,'--r',x,y2,'--r'); ylim([0,4]) ...

3 years ago | 1

Answered
When a global variable is justified
To fix this, I would need to intorduce an additional input variable in all definitions and calls. No, you could add the debug f...

3 years ago | 1

Answered
Fittype with anonymous function of multiple parameters and variables
alpha=1; beta=2; ft0 = fittype( @(gamma,x,y) exp(-(alpha.*x+beta*x.^2)).*exp(-(gamma*x.*y)),... '...

3 years ago | 0

| accepted

Answered
How to subtract false color gradient ?
detrend() operates column by column. I suspect you can avoid the lines by subtracting a plane fit to the whole surface instead, ...

3 years ago | 0

Answered
Create square marix of values for a 2 variable function.
x= 0:0.01:100; y=(0:0.01:100)'; f=cos(x)+sin(y)

3 years ago | 0

| accepted

Answered
Page-wise Diagonalization?
A=rand(4,1,3); pagetranspose(A) [n,~,p]=size(A); B=zeros(n^2,p); B(1:n+1:end,:)=reshape(A,n,p); B=reshape(B,n,n,p)

3 years ago | 1

Answered
Plot 2D images into 3D cylindrical image
Each slice of the 3D image can be obtained by using 2D scattered interpolation of the radial samples formed by the 2D images.. U...

3 years ago | 0

Answered
Calculation of the volume of a convex polytope as a function of indeterminate parameters
I don't know if the computation is tractable, in light of what John said, but here is code that will attempt it using the FEX do...

3 years ago | 1

Answered
To make smaller hexagons at the points marked with cross in black
Forming the hexagons is easy enough using nsidedpoly (see below), but you need to use the delaunay triangulation to determine wh...

3 years ago | 1

| accepted

Answered
scatteredInterpolant: what is linear interpolation in 2d?
No, the support points are being divided into triangular elements, not rectangles. It is puzzling that you would be using scatte...

3 years ago | 0

| accepted

Answered
Displaying MATLAB tables wrapped
One possibility, TBL=array2table(rand(4,12)); wrapit(TBL) function wrapit(T,ncols) if nargin<2, ncols=7; end M=c...

3 years ago | 0

Answered
Calculating distance between 2 curves
If you are trying to find the intersections of the magenta lines (extended to infinity) with the red curve, then this might help...

3 years ago | 0

Answered
Fmincon finds different solutions for optimization problem in dependance of initial values
You might find it easier to reach a good solution if you simplified the implementation of your constraints. In particular, your ...

3 years ago | 0

Answered
Can I loop through arguments and loop back to original names
Is this what you mean? inputs = {value, min, max}; for i = 1:numel(inputs) ... end [value,min,max]=inputs{:};

3 years ago | 0

| accepted

Answered
How are editors supposed to know the difference between transpose operators and character arrays?
A cheezy, but compact way you could define an alternative ctranspose operator (temporarily, within a particular workspace) is wi...

3 years ago | 2

| accepted

Load more