%  Plot 5 sine waves, 2 just above Nyquest, 2 just below, and 1 right at

fs = 1000;
Ts = 1/fs;
f0 = [0.6 0.8 1 1.2 1.4 2.6]*fs/2;
f1 = [0.6 0.8 1 0.8 0.6 0.6]*fs/2;
f00 = f0(3);

% Plot 5 cycles
tt  = 0:1/(20*fs):5/f00;
tt2 = 0:1/(01*fs):5/f00;

for ii=1:6
    subplot(6,1,ii)
    yy = sin(2*pi*f0(ii)*tt);
    zz = sin(2*pi*f0(ii)*tt2);
    ww = -sin(2*pi*f1(ii)*tt);
    if(ii==6) 
        ww = -ww;
    end

	plot(tt,yy)
    ylabel(ii)
    if(ii==1)
        title('Sampling Example')
    end
    if(ii==6)
        xlabel('time (s)')
    end
    if(0)
        hold on
        stem(tt2,zz)
        if(ii>3)
            plot(tt,ww,'r');
        end
        hold off
    end
	grid on
end

set(gcf, 'PaperPosition', [0.25 0.25 8 10.5])
