% Plot of cos(pi t) (u(t) - u(t-10))

t = -5:0.01:15;   % Define interval
% To find u(t-t1) in MATLAB, use (t >= t1)
% To multiply vectors in MATLAB, use .*
x = cos(pi*t) .* ((t >= 0) - (t >= 10));
plot(t,x)
grid
xlabel('t (seconds)');
ylabel('x(t)');
title('Plot of cos(\pi t) (u(t) - u(t-10))');
print -dpsc2 interval.ps
