MATLAB: How to create a half cosine wave

half cosine wave

s=cos(t) for -pi/2 to pi/2 else 0

Best Answer

If you are talking about plotting a half cosine wave you could do something like this:
t=-pi/2:0.0001:pi/2;
plot(t,cos(t))