clf;

t = 0:.01:10;
F = 1/4;
A = 1;
Th = pi/4;

xa = A*cos(2*pi*F*t + Th);

n=0:10;

f = 1/4;
A = 1;
Th = pi/4;

x = A*cos(2*pi*f*n + Th);

subplot(411)
plot(t,xa);
grid
hold on
plot([0 10],[0 0]);   % Plot axis
plot(n,x,'o');
ti=title('Sampling and reconstructing a CT signal');
set(ti,'FontSize',18);
yl=ylabel('x_a(t)');
set(yl,'FontSize',14);
set(yl,'FontWeight','bold');


n=0:10;

f = 1/4;
A = 1;
Th = pi/4;

x = A*cos(2*pi*f*n + Th);

subplot(412)
stem(n,x);
hold on
plot([0 10],[0 0]);   % Plot axis
grid
yl=ylabel('x(n)');
set(yl,'FontSize',14);
set(yl,'FontWeight','bold');

subplot(413)
y = A*cos(2*pi*f*floor(t) + Th);
plot(t,y);
grid
hold on
plot(n,x,'o');
plot([0 10],[0 0]);   % Plot axis
yl=ylabel('y_a(t)');
set(yl,'FontSize',14);
set(yl,'FontWeight','bold');

subplot(414)
plot(t,xa);
grid
hold on
plot([0 10],[0 0]);   % Plot axis
yl=ylabel('z_a(t)');
set(yl,'FontSize',14);
set(yl,'FontWeight','bold');

xl=xlabel('t (sec)');
set(xl,'FontSize',14);
set(xl,'FontWeight','bold');

tt=text(9.5,-1.77,'8/25/00');
set(tt,'FontSize',8);
set(tt,'FontName','Courier');

print -dps sampling.ps
