Error using ode23 function
Afficher commentaires plus anciens
Hi,
I am using the ode23 function as mentioned below but the code is not executing giving me the following error :
Error using odearguments (line 110) Inputs must be floats, namely single or double.
Error in ode113 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in WindkesselModel (line 80) [t_m2,P_m2] = ode113(Y2, [(n-1)*Tc; n*Tc], P_ss2);
The other parts of the code is following this step and using the same function for solving the equations. Can someone help me to solve that problem? I can attach the code for further checking.
Kindest regards,
Summer
1 commentaire
Jan
le 31 Juil 2015
There is no attached code.
Réponses (2)
ode113 is not a call of ode23. Please be more specific in the question.
According to the error message I guess, that some input in P_ss2 do not have the required type.
So please use the debugger to determine the types of the fields (if it is a struct). The code, which creates P_ss2 should reveal the problem also.
1 commentaire
Summer
le 31 Juil 2015
Torsten
le 31 Juil 2015
Y2=@(t,y)y;
Tc = 1;
n = 1;
P_ss2 = 1;
[t_m2,P_m2]=ode113(Y2,[(n-1)*Tc n*Tc],P_ss2);
plot(t_m2,P_m2(:,1))
should work.
You should compare to see where there are differences to the code you are using.
Best wishes
Torsten.
2 commentaires
Summer
le 31 Juil 2015
1. I0 in I(t) is a symbolic variable which is not allowed.
2. t is a vector, not a scalar as it should be.
3. The tspan vector is a column vector, not a row vector as it should be.
You will have to change these errors in the definition
Y2=@(t,y2) (-y2/(R*C)+I(t)/C);
before the call to ode113.
Best wishes
Torsten.
Catégories
En savoir plus sur Programming 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!