??? Input argument "x" is undefined.

I want to solve a set of nonlinear equations to get a set of six parameters x(1):x(6).These are my code:
function F = ParameterEstimation(x)
T = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12];
for T = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12];
miu(T) = [1;2;3;4;5;6;7;8;9;10;11;12]; %%not the actual values
sigma(T)=[1;2;3;4;5;6;7;8;9;10;11;12];
delta(T)=[1;2;3;4;5;6;7;8;9;10;11;12];;
dryprob(T)=[1;2;3;4;5;6;7;8;9;10;11;12];
end
x0 = [0; 0; 0; 0; 0; 0];
for T=1:12
F = [miu(T)-(x(1)*x(6)*(1+(x(2)/x(3)))*(x(5)/(x(4)-1))*T);
k1-(2*x(1)*(1+(x(2)/x(3)))*x(6)^2+(x(1)*(1+(x(2)/x(3))*(x(6)^2)*x(3)/((x(3)^2)-1)))*(x(5)^x(4)/(x(4)-1)));
k2-(((x(1)*(1+(x(2)/x(3)))* x(2))/((x(3)^2)-1))*(x(5)^x(4)/(x(4)-1)));
sigma(T) -((((2*x(5))^(2-x(4)))/(x(4)-2)*(k1-(k2/x(3))))-(((2*x(5))^(2-x(4)))/((x(4)-2)*(x(4)-3))*(k1-(k2/x(3)^2)))+(2/((x(4)-2)*(x(4)-3)))*(k1*((T+x(5))^(3-x(4)))-(k2/x(3))*((x(3)*T+x(5))^(3-x(4)))));
delta(T) - ((k1/ (x(4)-2)*(x(4)-3))*(x(5)^(3-x(4))+(2*T+x(5)^(3-x(4)))-(2*(T+x(5))^(3-x(4))))+(k2/(x(3)^2*(x(4)-2)*(x(4)-3)))*(2*((x(3)*T+x(5))^(3-x(3))))-x(5)^(3-x(4))-((2*x(3)*T+x(5))^(3-x(4))));
f1 - ((x(1)*x(5)/(x(3)*(x(4)-1)))*(1+(x(3)*(x(2)+(x(3)/2)))-(1/4)*x(3)*(x(2)+x(3))*(x(2)+2*x(3))+(x(3)*(x(2)+x(3))*(4*x(2)^2+27*x(2)*x(3)+36*x(3)^2))/72));
f2 - (x(1)*x(5)/((x(2)+x(3))*(x(4)-1))*(1-x(2)-x(3)+(3/2)*x(3)*x(2)+x(3)^2+(x(2)^2/2)));
f3 - ((x(1)*x(5)/((x(2)+x(3))*(x(4)-1)))*(x(5)/(x(5)+T*(x(2)+x(3))))^(x(4)-1)*(1-x(4)-x(3)+(3/2)*x(3)*x(2)+x(3)^2+(x(2)^2/2)));
dryprob(T)- (exp(-x(1)*T-f1+f2+f3))];
end
options=optimset('Display','iter'); % Option to display output
[x,fval] = fsolve(ParameterEstimation,x0,options); % Call optimizer
p/s : i am very sorry since the equations are too long. but that's the real equations i hv to solve. Then, i got the error ??? Input argument "x" is undefined. and i dont know what it is and how to fix it :( please help me......

 채택된 답변

Image Analyst
Image Analyst 2012년 2월 22일

0 개 추천

How did you call it? Did you assign a value to x and pass it in, something like this:
x_in = rand(7,1);
Fout = ParameterEstimation(x_in);

댓글 수: 2

srycandy
srycandy 2012년 2월 22일
i did assign initial value to every x which is 0.. do i still hv to do as recommended by u?
Image Analyst
Image Analyst 2012년 2월 22일
I don't understand this. You said you did assign initial values, so why are you asking if you still need to assign initial values? Yes, you have to assign initial values for x, even if they're all zero, and then call the function while passing x into the function like I showed.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by