MATLAB: How to plot m(t)=cos(2*pi*9*t) 0

plotting

how to plot m(t)=cos(2*pi*9*t) 0<t<3 and m(t)=0 otherwise

Best Answer

This works:
m = @(t) cos(2*pi*9*t) .* ((t > 0 ) & (t < 3));
t = linspace(-1, 4, 500);
Out = m(t);
figure(1)
plot(t, Out)
grid
Related Question