Error using fsolve Too many input arguments.

1 次查看(过去 30 天)
this is my code .Please tell me what am I doing wrong
x0=[1;1;1];
xSol=fsolve(@(x) lor(x),x0)
function fval= lor(X)
conc= X(1);
temperature=X(2);
TA1=X(3);
Tss = 30 + 273.15;
C2 = 0.1068;
C3 = 17.55;
Gmin = 4;
Gmax = 20;
C1 = 62.5;
Tin = 10 + 273.15;
A = 3.18;
Cpcoolant = 1.0;
V = 16.2;
k0 = 5.04*10^10;
E = 9310;
F0 = 0.5;
C0 = 11.5;
H = 22.6*1000;
rho = 1108.1;
Cp = 0.865;
T0 = 26.8 + 273.15;
G = C3;
Cprime = 100*(G-Gmin)/(Gmax-Gmin);
if Cprime < 20
Qc = 22;
elseif Cprime > 85.56
Qc = .01;
else
Qc = -0.00511*(Cprime-20)^2 + 22;
end
U = C1*Qc^(1./3.);
fval(3,1) = temperature - (temperature-Tin)/(1+U*A/(2*Qc*Cpcoolant*60*453.59))-TA1;
fval(1,1)= (-V*k0*exp(-E/temperature)*conc - F0*(conc-C0))/V;
fval(2,1) = (H*V*k0*exp(-E/temperature)*conc...
- U*A*(temperature-TA1)/60 - rho*F0*Cp*(temperature-T0))/(rho*V*Cp);
end

回答(1 个)

Torsten
Torsten 2017-10-24
Try to supply both x0 and fval as row vectors.
Best wishes
Torsten.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by