lsqnonlin question

3 ビュー (過去 30 日間)
Shalini
Shalini 2012 年 3 月 18 日
I have a function file called commands.m which gives the necessary inputs to another function file called fit_simp. lsqnonlin is called inside fit_simp.
My commands function file is as follows;
X=xlsread('MR01.xls',8,'AA63:AA133');
Y=xlsread('MR01.xls',8,'W63:W133');
X0=[800 1537 0.1722 7.169e-6 1];
lb = [800;0;0;0;0.7];
ub=[2000;2000;10;10;1];
StartAt = [800;1537;0.1722;7.169e-6;0.0001];
x=lsqnonlin(@(X0)fit_simp(X0,X,Y),StartAt,lb,ub);
And my fit_simp file is as follows;
function diff = fit_simp(x,X,Y)
% This function is called by lsqnonlin.
% x is a vector which contains the coefficients of the
% equation. X and Y are the option data sets that were
% passed to lsqnonlin.
A=x(1);
B=x(2);
n=x(3);
C=x(4);
m=x(5);
[total_readings,epsilon_dot_QS,epsilon_dot_MR,TM,TR,rho,Cp] = GetMRDetails;
for i=1:total_readings
if (i~=1)
d_epsilon=(X(i)-X(i-1));
sigma=diff(i-1)-Y(i-1);
dT=abs((1/(rho*Cp))*(sigma*d_epsilon));
TH=dT/(TM-TR);
diff(i)=(A+B*(X(i)^n)+C*log(epsilon_dot_QS/epsilon_dot_MR)+(1-(TH)^m));
else
diff(i)=(A+B*(X(i)^n)+C*log(epsilon_dot_QS/epsilon_dot_MR));
end
end
When I call commands by typing_ >>commands_ in the commands window, I get the following message:
Maximum number of function evaluations exceeded; increase options.MaxFunEvals
But when I type options in the commands window, it tells me;
??? Undefined function or variable 'options'.
Pleae can anyone guide me what is going wrong? How to increase the value of options.MaxFunEvals?Please help.....

採用された回答

the cyclist
the cyclist 2012 年 3 月 18 日
You have to use the optimset() function to determine the options that are being referred to here.
  1 件のコメント
Shalini
Shalini 2012 年 3 月 18 日
I called optimset but it gave me the following;
>> optimset
Display: [ off | iter | iter-detailed | notify | notify-detailed | final | final-detailed ]
MaxFunEvals: [ positive scalar ]
MaxIter: [ positive scalar ]
TolFun: [ positive scalar ]
TolX: [ positive scalar ]
FunValCheck: [ on | {off} ]
OutputFcn: [ function | {[]} ]
PlotFcns: [ function | {[]} ]
Algorithm: [ active-set | interior-point | levenberg-marquardt | trust-region-dogleg | trust-region-reflective ]
AlwaysHonorConstraints: [ none | {bounds} ]
BranchStrategy: [ mininfeas | {maxinfeas} ]
DerivativeCheck: [ on | {off} ]
Diagnostics: [ on | {off} ]
DiffMaxChange: [ positive scalar | {1e-1} ]
DiffMinChange: [ positive scalar | {1e-8} ]
FinDiffType: [ {forward} | central ]
GoalsExactAchieve: [ positive scalar | {0} ]
GradConstr: [ on | {off} ]
GradObj: [ on | {off} ]
HessFcn: [ function | {[]} ]
Hessian: [ user-supplied | bfgs | lbfgs | fin-diff-grads | on | off ]
HessMult: [ function | {[]} ]
HessPattern: [ sparse matrix | {sparse(ones(numberOfVariables))} ]
HessUpdate: [ dfp | steepdesc | {bfgs} ]
InitBarrierParam: [ positive scalar | {0.1} ]
InitialHessType: [ identity | {scaled-identity} | user-supplied ]
InitialHessMatrix: [ scalar | vector | {[]} ]
InitTrustRegionRadius: [ positive scalar | {sqrt(numberOfVariables)} ]
Jacobian: [ on | {off} ]
JacobMult: [ function | {[]} ]
JacobPattern: [ sparse matrix | {sparse(ones(Jrows,Jcols))} ]
LargeScale: [ on | off ]
LevenbergMarquardt: [ {on} | off ]
LineSearchType: [ cubicpoly | {quadcubic} ]
MaxNodes: [ positive scalar | {1000*numberOfVariables} ]
MaxPCGIter: [ positive scalar | {max(1,floor(numberOfVariables/2))} ]
MaxProjCGIter: [ positive scalar | {2*(numberOfVariables-numberOfEqualities)} ]
MaxRLPIter: [ positive scalar | {100*numberOfVariables} ]
MaxSQPIter: [ positive scalar | {10*max(numberOfVariables,numberOfInequalities+numberOfBounds)} ]
MaxTime: [ positive scalar | {7200} ]
MeritFunction: [ singleobj | {multiobj} ]
MinAbsMax: [ positive scalar | {0} ]
NodeDisplayInterval: [ positive scalar | {20} ]
NodeSearchStrategy: [ df | {bn} ]
NonlEqnAlgorithm: [ {dogleg} | lm | gn ]
ObjectiveLimit: [ scalar | {-1e20} ]
PrecondBandWidth: [ positive scalar | 0 | Inf ]
RelLineSrchBnd: [ positive scalar | {[]} ]
RelLineSrchBndDuration: [ positive scalar | {1} ]
ScaleProblem: [ none | obj-and-constr | jacobian ]
Simplex: [ on | {off} ]
SubproblemAlgorithm: [ cg | {ldl-factorization} ]
TolCon: [ positive scalar ]
TolConSQP: [ positive scalar | {1e-6} ]
TolPCG: [ positive scalar | {0.1} ]
TolProjCG: [ positive scalar | {1e-2} ]
TolProjCGAbs: [ positive scalar | {1e-10} ]
TolRLPFun: [ positive scalar | {1e-6} ]
TolXInteger: [ positive scalar | {1e-8} ]
TypicalX: [ vector | {ones(numberOfVariables,1)} ]
UseParallel: [ always | {never} ]
>> optimset.MaxFunEvals
Display: [ off | iter | iter-detailed | notify | notify-detailed | final | final-detailed ]
MaxFunEvals: [ positive scalar ]
MaxIter: [ positive scalar ]
TolFun: [ positive scalar ]
TolX: [ positive scalar ]
FunValCheck: [ on | {off} ]
OutputFcn: [ function | {[]} ]
PlotFcns: [ function | {[]} ]
Algorithm: [ active-set | interior-point | levenberg-marquardt | trust-region-dogleg | trust-region-reflective ]
AlwaysHonorConstraints: [ none | {bounds} ]
BranchStrategy: [ mininfeas | {maxinfeas} ]
DerivativeCheck: [ on | {off} ]
Diagnostics: [ on | {off} ]
DiffMaxChange: [ positive scalar | {1e-1} ]
DiffMinChange: [ positive scalar | {1e-8} ]
FinDiffType: [ {forward} | central ]
GoalsExactAchieve: [ positive scalar | {0} ]
GradConstr: [ on | {off} ]
GradObj: [ on | {off} ]
HessFcn: [ function | {[]} ]
Hessian: [ user-supplied | bfgs | lbfgs | fin-diff-grads | on | off ]
HessMult: [ function | {[]} ]
HessPattern: [ sparse matrix | {sparse(ones(numberOfVariables))} ]
HessUpdate: [ dfp | steepdesc | {bfgs} ]
InitBarrierParam: [ positive scalar | {0.1} ]
InitialHessType: [ identity | {scaled-identity} | user-supplied ]
InitialHessMatrix: [ scalar | vector | {[]} ]
InitTrustRegionRadius: [ positive scalar | {sqrt(numberOfVariables)} ]
Jacobian: [ on | {off} ]
JacobMult: [ function | {[]} ]
JacobPattern: [ sparse matrix | {sparse(ones(Jrows,Jcols))} ]
LargeScale: [ on | off ]
LevenbergMarquardt: [ {on} | off ]
LineSearchType: [ cubicpoly | {quadcubic} ]
MaxNodes: [ positive scalar | {1000*numberOfVariables} ]
MaxPCGIter: [ positive scalar | {max(1,floor(numberOfVariables/2))} ]
MaxProjCGIter: [ positive scalar | {2*(numberOfVariables-numberOfEqualities)} ]
MaxRLPIter: [ positive scalar | {100*numberOfVariables} ]
MaxSQPIter: [ positive scalar | {10*max(numberOfVariables,numberOfInequalities+numberOfBounds)} ]
MaxTime: [ positive scalar | {7200} ]
MeritFunction: [ singleobj | {multiobj} ]
MinAbsMax: [ positive scalar | {0} ]
NodeDisplayInterval: [ positive scalar | {20} ]
NodeSearchStrategy: [ df | {bn} ]
NonlEqnAlgorithm: [ {dogleg} | lm | gn ]
ObjectiveLimit: [ scalar | {-1e20} ]
PrecondBandWidth: [ positive scalar | 0 | Inf ]
RelLineSrchBnd: [ positive scalar | {[]} ]
RelLineSrchBndDuration: [ positive scalar | {1} ]
ScaleProblem: [ none | obj-and-constr | jacobian ]
Simplex: [ on | {off} ]
SubproblemAlgorithm: [ cg | {ldl-factorization} ]
TolCon: [ positive scalar ]
TolConSQP: [ positive scalar | {1e-6} ]
TolPCG: [ positive scalar | {0.1} ]
TolProjCG: [ positive scalar | {1e-2} ]
TolProjCGAbs: [ positive scalar | {1e-10} ]
TolRLPFun: [ positive scalar | {1e-6} ]
TolXInteger: [ positive scalar | {1e-8} ]
TypicalX: [ vector | {ones(numberOfVariables,1)} ]
UseParallel: [ always | {never} ]
How to change the default value of MaxFunEvals?

サインインしてコメントする。

その他の回答 (1 件)

Shalini
Shalini 2012 年 3 月 18 日
Thanks..Done the follwoing the commands functiona nd then it worked;
options = optimset('MaxFunEvals',10000); x=lsqnonlin(@(X0)fit_simp(X0,X,Y),StartAt,lb,ub,options);

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by