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 Center および File ExchangeSolver 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