| 1234567891011121314 |
- clear; clc; close all;
- ode_system = @(t, Y) [
- Y(2);
- Y(3);
- Y(4);
- cos(2*t) - Y(1) - (1-Y(1)^2)*Y(2) - (1+t)*Y(3) - 2*Y(4)
- ]
- t_span = [0 10];
- initial_conditions = [1 0 0 0];
- [t, Y] = ode45(ode_system, t_span, initial_conditions);
- y_sol = Y(:, 1);
- plot(t, y_sol);
|