Displaying results of lsqcurvefit after each iteration
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sergio Quesada
il 11 Giu 2018
Commentato: Sergio Quesada
il 12 Giu 2018
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 !!
0 Commenti
Risposta accettata
Alan Weiss
il 11 Giu 2018
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)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!