fsovle error 241

조회 수: 17 (최근 30일)
HAO-CHUN
HAO-CHUN 2012년 6월 27일
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.

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 6월 27일
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
Walter Roberson
Walter Roberson 2012년 6월 27일
Sean, did you mean
x = fsolve(fun, x0);
Sean de Wolski
Sean de Wolski 2012년 6월 27일
you betcha

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Integrity Kits for Industry Standards에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by