Error in Ode 45

1 visualizzazione (ultimi 30 giorni)
Francesco Renzulli
Francesco Renzulli il 6 Gen 2021
Commentato: Star Strider il 6 Gen 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

Risposta accettata

Star Strider
Star Strider il 6 Gen 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 Commenti
Francesco Renzulli
Francesco Renzulli il 6 Gen 2021
thanks a lot you solved it, it runs ....
Star Strider
Star Strider il 6 Gen 2021
As always, my pleasure!

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by