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

Antworten (2)

Jan
Jan am 31 Jul. 2015
Bearbeitet: Jan am 31 Jul. 2015

0 Stimmen

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 Kommentar

Summer
Summer am 31 Jul. 2015
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.

Melden Sie sich an, um zu kommentieren.

Torsten
Torsten am 31 Jul. 2015

0 Stimmen

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 Kommentare

Summer
Summer am 31 Jul. 2015
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 am 31 Jul. 2015
Bearbeitet: Torsten am 31 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 31 Jul. 2015

Bearbeitet:

am 31 Jul. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by