t = -2;yo = 5;w = 5;k = 0.1;for t = -2:20 if t < 0 y = -yo; elseif t < 10 y = -yo*(cos(w*t)); else y = -yo*(cos(w*t))*exp(-k*(t-10)); end plot(t,y,'.'); hold onendhold off
This is the code. I've looked everywhere and I just cannot figure out how to plot the oscillation curve I need from the given data in the code. Any help is appreciated. Thank you.
Best Answer