How to define constraints in least square fitting?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
For a data set (x, y), I am trying to fit a function f(p,x) using lsqcurvefit. I write as follow:
y=ydata;
x=xdata;
p0=[0.45;0.13];
%plot(curve2)
lb = [0.1; 0.11 ];
ub = [1.0; 0.16 ];
options = optimoptions('lsqcurvefit','Display','iter','Algorithm','trust-region-reflective','OptimalityTolerance', 1e-6,'FunctionTolerance',1e-6);
[p,resnorm,residual,exitflag,output,lambda] = lsqcurvefit(@DOS_BCSfit(p,x),p0,x,y,lb,ub,options)
In my case, the final output for my parameters is x=0.1 and 0.16, which is some how just the values defiend in bound constraints.
Can someone help me in pointing out the mistake?
Thanks,
Best regards,
Ritika
2 Kommentare
dpb
am 7 Jun. 2019
There may be no mistake...we can't see what the functional you're trying to fit looks like--quite possible the constraints are such as given that the best fit is at that bound...
Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!