Professional Documents
Culture Documents
I compute the frequency samples of DTFT. Three parameters are the number of points, the numerator and the denominator. Then i draw four figures. They are real part of DTFT, imaginary part of DTFT, magnitude spectrum of DTFT and phase spectrum of DTFT respectively.
w=0:pi/256:pi; %the number of discrete-time points
num=[0.7 -0.5 0.3 1]; %the numerator den=[1 0.3 -0.5 0.7]; %the denominator h=freqz(num,den,w); subplot(2,2,1) plot(w/pi,real(h)); % real part of DTFT title('real part of DTFT') subplot(2,2,2) plot(w/pi,imag(h)); % imaginary part of DTFT title('imaginary part of DTFT') subplot(2,2,3) plot(w/pi,abs(h)); % magnitude spectrum of DTFT title('magnitude spectrum of DTFT') subplot(2,2,4) plot(w/pi,angle(h)); % phase spectrum of DTFT title('phase spectrum of DTFT')
title('the magnitude spectrum of original sequence') subplot(2,2,2) plot(w/pi,angle(h1)); % the phase Spectrum of original sequence title('the phase Spectrum of original sequence') subplot(2,2,3) plot(w/pi,abs(h2)); % the magnitude spectrum of time-shifted sequence title('the magnitude spectrum of time-shifted sequence') subplot(2,2,4) plot(w/pi,angle(h2)); % the phase spectrum of time-shifted sequence title('the phase spectrum of time-shifted sequence'
subplot(2,2,1) plot(w/pi,abs(hp)); % the magnitude spectrum of hp title('the magnitude spectrum of hp') subplot(2,2,2) plot(w/pi,angle(hp)); % the phase Spectrum of hp title('the phase Spectrum of hp') subplot(2,2,3) plot(w/pi,abs(h3)); % the magnitude spectrum of h3 title('the magnitude spectrum of h3') subplot(2,2,4) plot(w/pi,angle(h3)); % the phase Spectrum of h3 title('the phase Spectrum of h3')
subplot(2,2,2) plot(w/pi,angle(h1)); % the phase Spectrum of original sequence title('the phase Spectrum of original sequence') subplot(2,2,3) plot(w/pi,abs(h3)); % the magnitude spectrum of time-reversed sequence title('the magnitude spectrum of time-reversed sequence') subplot(2,2,4) plot(w/pi,angle(h3)); % the phase spectrum of time-reversed sequence title(' the phase spectrum of time-reversed sequence')