Displaying results of lsqcurvefit after each iteration
조회 수: 5 (최근 30일)
이전 댓글 표시
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
채택된 답변
Alan Weiss
2018년 6월 11일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!