ODE45 returns NaN

12 visualizaciones (últimos 30 días)
Raquel Andrade
Raquel Andrade el 24 de Mayo de 2022
Comentada: Raquel Andrade el 24 de Mayo de 2022
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)')

Respuestas (1)

Alan Stevens
Alan Stevens el 24 de Mayo de 2022
t = 0 causes a problem. Try tspan = [0.1 100]; for example.
  1 comentario
Raquel Andrade
Raquel Andrade el 24 de Mayo de 2022
It worked, thank you so much!!

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by