フィルターのクリア

Error in Ode 45

1 回表示 (過去 30 日間)
Francesco Renzulli
Francesco Renzulli 2021 年 1 月 6 日
コメント済み: Star Strider 2021 年 1 月 6 日
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

採用された回答

Star Strider
Star Strider 2021 年 1 月 6 日
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 件のコメント
Francesco Renzulli
Francesco Renzulli 2021 年 1 月 6 日
thanks a lot you solved it, it runs ....
Star Strider
Star Strider 2021 年 1 月 6 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by