%% wave1dfreqdemo %% show 1D pure wave forms as a function of frequency %define sample rates and frequency N = 32 tN = (0:(N-1))/N; % discrete time points K = N; % number of displays i = sqrt(-1); % display results for k = 0:K sampwave = exp(2*pi*i*k*tN); subplot(3,1,1); plot([0,N],[0,0],'k', [k,k], [-0.5,0.5],'b', k,0.5,'ob',k,-0.5,'ob'); axis([-1,N+1,-1.1,1.1]); title('frequency'); drawnow subplot(3,1,2); plot(tN,real(sampwave),'r'); axis([-0.1,1.1,-1.1,1.1]); title('real part'); drawnow subplot(3,1,3); plot(tN,imag(sampwave),'g'); axis([-0.1,1.1,-1.1,1.1]); title('imaginary part') disp(['k=',num2str(k),', press a key']) drawnow pause end