How to define constraints in least square fitting?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
dpb
el 7 de Jun. de 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...
Respuestas (0)
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!