Ode23 error using odearguments

7 次查看(过去 30 天)
Hello,
I am trying to run a code found on web (linked below) and I am encountering a problem with ODE23 function:
Code:
%% Numerical Solution for 2 Element WM
t=(n-1)*Tc :.01: n*Tc ;
I = @ ( t ) I0* sine ( t-(n-1)*Tc ) .* ( t <= (( n-1)*Tc+Ts )) ;
Y2= @ ( t , y2 ) (-y2 / ( R*C )+I ( t ) /C ) ;
[t_m2 , P_m2 ] = ode23 (Y2, [(n-1)*Tc; n*Tc], P_ss2 ) ;
P_ss2=P_m2 ( end ) ;
subplot (4,1,3)
hold on
plot ( t_m2 , P_m2)
ylim ([ 0 150])
xlim ([0 cycle *Tc ] )
title ( ' Aortic Blood Pressure ( Numerical Analysis 2 Element WM) ' )
ylabel ( ' Pressure (mmHg) ' )
xlabel ( ' time ( s ) ' )
Errors:
Error using odearguments
Inputs must be floats, namely single or double.
Error in ode23 (line 106)
odearguments(odeIsFuncHandle, odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in prject1 (line 68)
[t_m2 , P_m2 ] = ode23 (Y2, [(n-1)*Tc; n*Tc], P_ss2 ) ;
Thank you for all help in advence
Used code does not belong to me, I found it here: https://isn.ucsd.edu/courses/beng221/problems/2012/BENG221_Project%20-%20Catanho%20Sinha%20Vijayan.pdf

采纳的回答

Walter Roberson
Walter Roberson 2022-5-24
I0=subs ( I0 , ' 3.14 ' , pi ) ;
After that add
IO = double(IO);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by