| 12345678910111213141516171819 |
- clear all; close all; clc;
- ode_system = @(t, Y) [
- Y(2);
- -3 - (t^2 + Y(1))*Y(1) - (3*t+2*Y(1))*Y(2)
- ];
- t_span = [0, 10];
- initial_conditions = [1; 0];
- [t, Y] = ode45(ode_system, t_span, initial_conditions);
- figure;
- hold on;
- grid on;
- plot(t, Y(:, 1));
- plot(t, Y(:, 2));
- legend("y(t)", "y'(t)");
- xlabel("t");
- ylabel("y(t) & y'(t)");
|