lsqnonlin question
3 ビュー (過去 30 日間)
古いコメントを表示
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.....
0 件のコメント
採用された回答
the cyclist
2012 年 3 月 18 日
You have to use the optimset() function to determine the options that are being referred to here.
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!