least square root fit with piecewise function

3 views (last 30 days)
I would like to perform a fit with a piecewise function, but the curve fitting app doesn't allow that. I have 102 points (see the figure), and I think they could fit nicely with 2 lines. mind that the plot is bi-logaritmic and I want to impose the least square root in the linear space. I also would like to impose a constraint on the area under the fitting curve. I tried to use lsqcurvefit but it converges very slowly. I used those options
options = optimoptions('lsqcurvefit','Algorithm','trust-region-reflective',...
'PrecondBandWidth',0,'SubproblemAlgorithm','cg','MaxFunEvals',4*10^5,'MaxIter',4*10^5,'TolFun',10^-25, ...
'StepTolerance', 10^-10);
and it took those times (to reach the stop criteria) %%'MaxFunEvals',4*10^5,'MaxIter',4*10^5 it takes 327 %%'MaxFunEvals',4*10^5,'MaxIter',4*10^5 it takes 278 'cg' %%'MaxFunEvals',4*10^5,'MaxIter',4*10^5 it takes 137 'cg' PrecondBandWidth 0 %%'MaxFunEvals',4*10^6,'MaxIter',4*10^5 it takes 1100 %%'MaxFunEvals',4*10^6,'MaxIter',4*10^5 it takes 410 'cg' PrecondBandWidth 0 when I say that the solution moves a little, I mean that from x1=4.0*10^5 in the last example it converges at 3.90*10^5
what can I do?

Answers (0)

Categories

Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!