'how to get results of each iteration from curve fitting process in matlab

I was do curve fitting on a custom function in matlab (lsqcurvefit()) , I wanted to get some information in each iteration like estimated parameters (p1,p2,p3,p4) and errors to plot some informative graphs. I used option('iter') input but it doesn't show them(actually i need their values to plot them) .

fun=@(p,t) p(1)*exp(-t./p(2)) + p(3)*t.*exp(-t/p(4));
options = optimoptions('lsqcurvefit','PlotFcn','optimplotresnorm' ,'Algorithm','levenberg-marquardt','Display','iter-detailed');

[p,resnorm,residual,~,~,lambda,jacobian] = lsqcurvefit(fun,[100,100,100,100],t,y,[],[],options);

it is my code. thank you for helping me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source