??? Input argument "x" is undefined.

2 次查看(过去 30 天)
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
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 个)

类别

Help CenterFile 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