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