Error using ode23 function

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

回答(2 个)

Jan
Jan 2015-7-31
编辑:Jan 2015-7-31

0 个投票

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 个评论

Hello,
Thank you for your answer. am sorry this was the error when I tried to use other function but it has the same error. This is the error message: Error using odearguments (line 110) Inputs must be floats, namely single or double.
Error in ode23 (line 112) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in WindkesselModel (line 80) [t_m2,P_m2] = ode23(Y2, [(n-1)*Tc; n*Tc], P_ss2);
and I attached the code now.

请先登录,再进行评论。

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 个评论

Hello,
Thank you for your answer. It's working for the variables that you gave me but it's not working for the variables am using.
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.

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息

提问:

2015-7-31

编辑:

2015-7-31

Community Treasure Hunt

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

Start Hunting!

Translated by