Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

MATLAB only opening up most recent plot

1 visualización (últimos 30 días)
Anjana
Anjana el 31 de Jul. de 2024
Cerrada: John D'Errico el 31 de Jul. de 2024
MATLAB only opens figure 4, not figure 3
t0 = 0; tf = 50; y0 = [-2;-1.7];
[t,Y] = ode45(@f,[t0,tf],y0,[]);
y=Y(:,1);v=Y(:,2);
[t,Y(:,1),Y(:,2)];
figure(3);
plot(t, y,'b-', t,v,'r-' )
xlabel('t'); ylabel('y, v = y''');
legend('y(t)','v(t)')
ylim([-2.5,2.5]);xticks(0:10:50);
grid on
figure(4);
plot(y,v); axis square; xlabel('y'); ylabel('v=y''');
ylim([-2.5,2.5])
xlim([-2.5,2.5])
grid on
% plot the phase plot %----------------------------------------------------------------------
function dydt = f(t,Y)
y = Y(1); v = Y(2);
dydt = [v;-2*sin(t)-v-2*y ];
end

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by