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 件のコメント

Jan
Jan 2015 年 7 月 31 日
There is no attached code.

サインインしてコメントする。

回答 (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 件のコメント

Summer
Summer 2015 年 7 月 31 日
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.

サインインしてコメントする。

Torsten
Torsten 2015 年 7 月 31 日

0 投票

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 件のコメント

Summer
Summer 2015 年 7 月 31 日
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.
Torsten
Torsten 2015 年 7 月 31 日
編集済み: Torsten 2015 年 7 月 31 日
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