How can I set options in lsqnonlin?

조회 수: 41 (최근 30일)
Eduardo Chacin
Eduardo Chacin 2018년 10월 18일
댓글: Alan Weiss 2018년 10월 19일
Hi! I'm using lsqnonlin and I want to increase the number of iterations, for what I've read I need to use the "MaxIterations" option, but I'm not sure how to use it, could someone help me out? This is what I've written:
i
function IFc
filename='variables.xlsx';
sheet=3;
IFext = xlsread(filename,sheet,'C2:C9');
IFsec = xlsread(filename,sheet,'D2:D9');
q=length(IFext);
%Initial par
par1=0.7;
%Initial results
IFextcini = par1.*IFsec;
RD=(((IFext-IFextcini).^2).^0.5)./IFext;
ARD=sum(RD)./q.*100;
display (ARD)
%Optimization
lb=0;
ub=inf;
p0 =0.7;
p = lsqnonlin(@(p)fun(p,IFext,IFsec),p0,lb,ub);
%Final results
IFextcfin = p(1).*IFsec;
RD=(((IFext-IFextcfin).^2).^0.5)./IFext;
ARD=sum(RD)./q.*100;
display (ARD)
p
end
function res = fun(p,IFext,IFsec)
IFextc = p(1).*IFsec;
res = (IFextc-IFext)./IFext;
end

채택된 답변

Stephan
Stephan 2018년 10월 18일
편집: Stephan 2018년 10월 18일
Hi,
check optimoptions - there are also examples and the lsqnonlin options in the documentation.
Best regards
Stephan
  댓글 수: 1
Alan Weiss
Alan Weiss 2018년 10월 19일
In particular, this example from the lsqnonlin function reference page.
Alan Weiss
MATLAB mathematical toolbox documentation

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by