1. Problems with lsqcurvefit - MATLAB
Hi
I have a dataset for x,y which I need to fit with following equation(y=f(x,y)).
y=(4.1/lp)*((1./(4*(1-(x/L-(y/K0))).^2))+x/L-(y/K0)-0.25);
where lp, L and K0 are the parameters used for optimization.
I am using lsqcurvefit to ooptimize the parameters and here is my .m file.
l=load('...');
x=l(:,1);
y=l(:,2);
data=[x y];
zdata=y;
c0=[0.7 1 50000];
F=(4.1/c0(1))*((1./(4*(1-(x/c0(2))+(y/c0(3))).^2))+(x/c0(2))-(y/c0(3))-0.25);
[c, resnorm]=lsqcurvefit(@myfun,c0,data,zdata)
end
However, when I run this, it generates following error:
?? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.
Error in ==> optimget
Caused by:
Failure in initial user-supplied objective function evaluation. LSQCURVEFIT cannot continue.
I changed the recursion limit to 5000 and run. Unfortunately this crashes the matlab.
Looking for help.
Thank you
rakshit
3. problems with lsqcurvefit and quad (loop) - MATLAB
4. Problem with lsqcurvefit Display option
I'm running Matlab 6.5 (Student Version) and the Optimization Toolbox
version 2.2
When I run lsqcurvefit on my data, with no options specified, I get the
message:
Optimization terminated successfully:
Relative function value changing by less than OPTIONS.TolFun
When I use the "optimset" command to set the Display option:
options = optimset('Display','notify');
x = lsqcurvefit(f,x0,x1data,ydata,lb,ub,options);
I get the same "Optimization terminated successfully" message.
I thought that setting "Display" to "notify" meant that I'd only get
output if the function failed to converge, and "Optimization terminated
successfully" would seem to indicate that the function *did* converge.
Am I misunderstanding the meaning of "Optimization terminated successfully"?
Am I misunderstanding what "Display = notify" does?
Is this a bug?
FWIW, "Display = final", "Display = iter" and "Display = off" appear to
work as expected. Note that "Display = final" and "Display = notify"
give the same result.
Bob Pownall
5. curve fitting problem with lsqcurvefit - MATLAB
6. lsqcurvefit cannot seem to solve allometric problem?
I have a set of (x,y) that I want to fit using the allometric relation: y = a*(y-b)^c so I would need to estimate 3 variables (a,b,c). However, after modifying numerous online examples and doing my own, I always get the QR error about complex values (even when I set the upper and lower bounds to real numbers). For example: xdata=[0.006828287172237330 0.790682195827279000 0.003735589633394300 0.588505280987413000 0.049935384458074200 0.249101128117032000 ]; ydata=[0.000422158958434916 0.476084662925104000 -0.003271705711918840 0.335717811245073000 0.006198209732454980 0.062046706155897800 ]; predicted = @(a,x) a(1)*(x - a(2)).^a(3); a0=[2;2;2]; [ahat,resnorm]=lsqcurvefit(predicted,a0,xdata,ydata); ------> Results in: "??? Error using ==> qr Complex sparse QR is not yet available. ..." Any ideas? Did I use this incorrectly? Thanks in adavance! Eric
7. lsqcurvefit boundary problem - MATLAB
i'm trying to fit two curves using the lsqcurvefit. to do that i need to define a function predicted=@(x,Xdata_3500) x(1)*x(2)*(x(3)+1)*(((Xdata_3500-(-2.5))./x(4)).^(x(3))).*exp(-x(2)*(((Xdata_3500-(-2.5))./x(4)).^(x(3)+1)))+(1-x(1))*x(5)*(x(6)+1)*(((Xdata_3500-(-2.5))./x(7)).^(x(6))).*exp(-x(5)*(((Xdata_3500-(-2.5))./x(7)).^(x(6)+1))) ; x0=[0.5;5;2;10;6;1;80]; [ahat,resnorm,residual,exitflag,output,lambda,jacobian]=... lsqcurvefit(predicted,x0,Xdata_3500,Ydata_3500); i've noticed that each time i change x0 values and run lsqcurvefit again, i'm obtaining new parameters for ahat. although the 2 curves are well coherent, i have constraints concerning the parameters, and i need them to respect certain intervalls. any advice?