MATLAB: How to solve it and make a graph for it

MATLABthe equation of spring motion

Best Answer

odefun=@(x,u)[u(2);(sin(x)-2*u(2)-7*u(1))/3];
tspan=[0 2*pi];%assumed interval for x
uzero=[0 0];%not sure what your boundary conditions are [u(0), u'(0)]
[x,u]=ode45(odefun,tspan,uzero);
plot(x,u)
Related Question