How to get ode45 to work with my function?
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numeric Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!