ODE45 returns NaN

조회 수: 12 (최근 30일)
Raquel Andrade
Raquel Andrade 2022년 5월 24일
댓글: Raquel Andrade 2022년 5월 24일
I wrote this code to plot the solution of an EDO, but MATLAB just returns NaN values. I can't find my mistake, can anyone help me?
tspan = [0 100];
v0 = 0;
[t,v] = ode45(@(t,v)(4800./(2200.*(1-0.8.^(t./40)))- 9.81),tspan,v0)
figure(1)
plot(t,v,'-o')
xlabel('Time (s)')
ylabel('Speed (m/s)')

답변 (1개)

Alan Stevens
Alan Stevens 2022년 5월 24일
t = 0 causes a problem. Try tspan = [0.1 100]; for example.
  댓글 수: 1
Raquel Andrade
Raquel Andrade 2022년 5월 24일
It worked, thank you so much!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by