fsovle error 241

17 views (last 30 days)
HAO-CHUN
HAO-CHUN on 27 Jun 2012
Please check for me
Function m-file
function F = spice_fsolve_singleinput_v1(x, Vmax, v, DTmax, Imax, Tau, Tamb,Kt,UA, Tw)
%x(1) = Tc, x(2) = Th, x(3) = vt
F = [(Vmax/x(2))*x(1)*(v/(Vmax*(x(2)-DTmax)/Imax*x(2))) + 1/2*Tau*(v/(Vmax*(x(2)-DTmax)/Imax*x(2)))*(x(2)-x(1)) - 1/2*(v/(Vmax*(x(2)-DTmax)/Imax*x(2)))^2*(Vmax*(x(2)-DTmax)/Imax*x(2)) - ((DTmax*2*x(2))/(Imax*Vmax*(x(2)-DTmax)))*(x(2)-x(1)) - Kt*(Tamb-x(1))
(Vmax/x(2))*x(2)*(v/(Vmax*(x(2)-DTmax)/Imax*x(2))) - 1/2*Tau*(v/(Vmax*(x(2)-DTmax)/Imax*x(2)))*(x(2)-x(1)) + 1/2*(v/(Vmax*(x(2)-DTmax)/Imax*x(2)))^2*(Vmax*(x(2)-DTmax)/Imax*x(2)) - ((DTmax*2*x(2))/(Imax*Vmax*(x(2)-DTmax)))*(x(2)-x(1)) - UA*(x(2)-Tw)
(Vmax/x(2))*(x(2)-x(1)) + (v/(Vmax*(x(2)-DTmax)/Imax*x(2)))*(Vmax*(x(2)-DTmax)/Imax*x(2))-x(3)];
the run-file
DTmax = 69;
Imax = 3.6;
Vmax = 3.8;
Tau=0.1;
Tw=295.75;
Kg=1.05;
Kw=0.58;
v = 0.1878;
Kt =0.081;
UA =10;
Kc = (Kt*(Kg*0.1)*(Kw*1.6))/((Kw*1.6)*(Kg*0.1)-Kt*(Kw*1.6)-Kt*(Kg*0.1));
Tamb = 295.75;
x0 = [295.75; 295.75; 0.1];
x = fsolve(@spice_fsolve_singleinput_v1, x0)
Error came out
Error using spice_fsolve_singleinput_v1 (line 5)
Not enough input arguments.
Error in fsolve (line 241)
fuser = feval(funfcn{3},x,varargin{:});
Error in run_spice_fsolve_singleinput_v1 (line 35)
x = fsolve(@spice_fsolve_singleinput_v1, x0)
Caused by:
Failure in initial user-supplied objective
function evaluation. FSOLVE cannot continue.

Accepted Answer

Sean de Wolski
Sean de Wolski on 27 Jun 2012
You need to pass the various extra arguments to spice_fsolve_singleinput_v1. doc passing extra parameters
For your above case:
fun = @(x)spice_fsolve_singleinput_v1(x, Vmax, v, DTmax, Imax, Tau, Tamb,Kt,UA, Tw)
x = fsolve(fun, x0)
  2 Comments
Walter Roberson
Walter Roberson on 27 Jun 2012
Sean, did you mean
x = fsolve(fun, x0);
Sean de Wolski
Sean de Wolski on 27 Jun 2012
you betcha

Sign in to comment.

More Answers (0)

Categories

Find more on Signal Integrity Kits for Industry Standards in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!