lsqnonlin question
이전 댓글 표시
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.....
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!