필터 지우기
필터 지우기

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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by