Borrar filtros
Borrar filtros

Error in Ode 45

1 visualización (últimos 30 días)
Francesco Renzulli
Francesco Renzulli el 6 de En. de 2021
Comentada: Star Strider el 6 de En. de 2021
I have a probleb solving this ode ODE it gives me the following errors
or too many inputs in the ode45
or Inputs must be floats, namely single or double.
burn_time=100;
Nt=1000;
m_ox=0.7;
t=linspace(0,burn_time,Nt);
m_ox=m_ox.*ones(1,Nt);
Dp_in=0.0005;
rho_fuel=1.9;
L_grain=0.5;
%% Definizione regression rate
a=0.007;
b=0.67;
r_dot=a.*m_ox.^b;% in futuro r_dot sara gia fornito da dati sperimentali
C=((m_dot_fuel+m_ox-m_dot_pr)./(v_cham)) ;
A=((4.*r_dot)./Dp_t);
dt=t(2)-t(1);
t_span=(0:dt:burn_time);
y_0=zeros(1,Nt);
y_0=y_0(:);
[T,Y ]=ode45(@(t,y) vdp1(C,y,A),t_span,y_0);
function dydt = vdp1(C,y,A)
dydt =C+A*y;
dydt=dydt(:);
end

Respuesta aceptada

Star Strider
Star Strider el 6 de En. de 2021
The problem here:
[T,Y ]=ode45(@(t,y) vdp1(C,y,A),t_span,y_0);
is that one of the input arguments to ‘vdp1’ needs to be ‘t’.
There are too many missing constants for me to run your code, however this:
[T,Y ]=ode45(@(t,y) vdp1(t,C,y,A),t_span,y_0);
should work, if there are no other problems.
  6 comentarios
Francesco Renzulli
Francesco Renzulli el 6 de En. de 2021
thanks a lot you solved it, it runs ....
Star Strider
Star Strider el 6 de En. de 2021
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by