How to define constraints in least square fitting?

2 Ansichten (letzte 30 Tage)
ri_p
ri_p am 7 Jun. 2019
Kommentiert: ri_p am 7 Jun. 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 Kommentare
dpb
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...
ri_p
ri_p am 7 Jun. 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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

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!

Translated by