How to define constraints in least square fitting?

2 visualizaciones (últimos 30 días)
ri_p
ri_p el 7 de Jun. de 2019
Comentada: ri_p el 7 de Jun. de 2019
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
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...
ri_p
ri_p el 7 de Jun. de 2019
Hi,
Thank you for looking at my question. I attach the data and function that I am trying to fit.
The function looks correct when I plot the function and data together at expected intial values. But, the fitting is not working as expected.
I will be grateful if you can help me in understanding this.
Cheers,
Ritika

Iniciar sesión para comentar.

Respuestas (0)

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!

Translated by