How to get ode45 to work with my function?
이전 댓글 표시
I keep getting these error messages:
Undefined function 'mrdivide' for input arguments of type 'function_handle'.
Error in adiabatic (line 35) k = kt*exp((E/R2)*((1/T0)-(1/f)));
Error in odearguments (line 90) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in KineticsProject (line 14) [X,V] = ode45(@adiabatic,Xspan,V0)
if true
function dXdV = adiabatic(V,X)
syms T
eqn1 = ((CpA+CpB)*(T-T0))+(X*(HRXStand+HvapA+HvapC+(CpC*(T-BPC))+(CpD*(T-T0))-(CpA*(T-BPA))-(CpB*(T-T0)))) == 0;
T = vpasolve(eqn1,T);
f = matlabFunction(T);
k = kt*exp((E/R2)*((1/T0)-(1/f)));
CA = CA0*(1-X);
CB = CA0*(1-X);
rA = k*CA*(CB^0.5); % mol/liter*s
dXdV = rA/FA0;
end
I plugged it into the following code (all variables in eqn1 have been defined):
if true
Xspan = [0,0.5];
V0 = 0;
[X,V] = ode45(@adiabatic,Xspan,V0)
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!