ex7_12 - x(12:21)=zeros(1,10); n = 0:N-1; clf...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Example 7.12 N = 26; n=0:N-1; x = .9.^n; clf subplot(211),stem(n,x) title('Example 7.12, x[n]') ylabel('x[n]') xlabel('n') pause % plot the DTFT Omega = 0:2*pi/400:2*pi; X = 1./(1-.9*exp(-j*Omega)); subplot(211),plot(Omega,abs(X)); title('DTFT of x[n]') ylabel('|X|'); axis([0 2*pi 0 10]) % % truncate x at n = 21 and take a 21 point DFT N = 21; x = x(1:N); Xk=dft(x); k = 0:N-1; subplot(212),stem(k,abs(Xk)) title('21-Point DFT of x[n]') ylabel('|Xk|') xlabel('k') text(1,8.6,'8.9') pause % % Rerun for x truncated after n=10 and take a 21 point DFT
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x(12:21)=zeros(1,10); n = 0:N-1; clf subplot(211),stem(n,x) title('Truncated x[n]') ylabel('x[n]') xlabel('n') pause % % replot the DTFT of x[n] for comparison subplot(211),plot(Omega,abs(X)); title('DTFT of x[n]') ylabel('|X|'); axis([0 2*pi 0 10]) % % compute and plot the DFT of the truncated x[n] Xk=dft(x); subplot(212),stem(k,abs(Xk)); title('21-Point DFT of truncated x[n]') ylabel('|Xk|') xlabel('k') text(1,6.6,'6.82') subplot(111)...
View Full Document

Ask a homework question - tutors are online