%% wave 1D
%% show 1D pure wave forms and aliasing
 
%define sample rates and frequency

N  = 8   % number of discrete samples
Ny = 128 % 'continuous' or fine sampling
tN = (0:1:(N-1))/N;  % discrete time points
tNy = (0:1:(Ny-1))/Ny;  % continuous or fine sampling time points   
K = 2*N;  % number of displays
i = sqrt(-1);

% display results 
for k = 0:2*N 
   sampwave = exp(2*pi*i*k*tN);
   wave = exp(2*pi*i*k*tNy);
   subplot(2,1,1)
   plot(tNy,real(wave),'-r',tN,real(sampwave),'o');
   axis([-0.1,1.1,-1.1,1.1]);
   title('real part');
   subplot(2,1,2)
   plot(tNy,imag(wave),'-g',tN,imag(sampwave),'o');
   axis([-0.1,1.1,-1.1,1.1]);
   title('imaginary part')
   disp(['k=',num2str(k),', press a key']) 
   pause
   end

