I'm new to MATLAB and i'm trying to create two subplots side by side, where the only difference is the 'k' value in the mass spring damper equation is different.
Here is the code:
function zprime= msdfunc(t,z)m = 4; b = 0.25; k = 2;zprime=[z(2);-(b/m)*z(2)-(k/m)*z(1);];endtspan=[0, 60];y0=[0, 4];[t, y]=ode45(@msdfunc, tspan, y0);plot(t, y);
I need to plot the equation for k=2 and k=4.
Thanks in advance
Best Answer