Displaying results of lsqcurvefit after each iteration

5 visualizzazioni (ultimi 30 giorni)
Good evening,
I have solved a problem with lsqcurvefit, and now I want MatLab to display the solutions found after each iteration. The problem is my objective function, called "Iteor", is obtained by fsolve, like this:
rteor=@(k,r) fsolve(@(r) arrayfun(@(R,T) FC.*integral(@(x) exp(-a./(x.*log(x))), 1, R)-(T-(.001.*k(1))),r,texp), inpts, options);
Iteor=@(k,r) ((.01.*k(2)./FC).*(rteor(k,texp)).*exp(a./(rteor(k,texp)).*log(rteor(k,texp))))+(Vo./(100.*k(3).*log(rteor(k,texp))));
k = lsqcurvefit(Iteor, x0, texp, Iexp,[],[],options)
I have tried with
options = optimoptions('lsqcurvefit','Display','iter');
but, it returns technical info, not the solutions of my parameters. I've also tried with
options = optimoptions('lsqcurvefit','PlotFcn','optimplotx');
,but it makes the program to plot the parameters values in a graph, and I want it displayed...
Thanks you !!

Risposta accettata

Alan Weiss
Alan Weiss il 11 Giu 2018
Write yourself a simple Output Function such as this:
function stop = outfun(x,optimVals,state)
stop = false;
switch state
case 'iter'
disp(x)
end
I just wrote this off the top of my head, so it might not be 100% right, but something like this will work. Include the output function in your options, and pass the options to lsqcurvefit.
Alan Weiss
MATLAB mathematical toolbox documentation

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by