??? 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......

 Respuesta aceptada

Image Analyst
Image Analyst el 22 de Feb. de 2012

0 votos

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 comentarios

srycandy
srycandy el 22 de Feb. de 2012
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 el 22 de Feb. de 2012
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Community Treasure Hunt

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

Start Hunting!

Translated by