Euler's method to determine system of first order DE in MATLAB

1k Views Asked by At

d^2y/dt^2 + 4dy/dt + 3y = sin(t)

Rewrite the second order DE as a system of first order DE and use Euler's method to numerically determine the solution for t = 0 to t = 20. Use Y(0) = (1,2) as your initial condition. Note that you may have to modify your Euler's code to do this properly. Plot both v (your second system variable) vs y and also y vs t Use enough points so that the curve looks smooth. Also construct a graph of the system: d^2y/dt^2 + 4dy/dt + 3y = 0

**Discuss the difference that the forcing term sin(t) makes. **

I have the second order rewritten as: dy/dt = v;
dv/dt = sin(t) - 4v - 3y;

Need help finishing this code to plot what is asked.
My Matlab code is pictured here with the output it gives

enter image description here

enter image description here