% % Filename: example9.m % % Description: m-file to plot spectra of x[n]=(.5^n)u[n] % n = 0:10; % plot x[n] x = 0.5.^n; subplot(3,1,1); stem(n,x,'filled'); xlabel('n'); ylabel('x[n]'); title('DT Signal x[n] = (0.5^n)u[n]'); W = -3*pi:0.01:3*pi; % compute X(W) X = 1./(1 - 0.5*exp(-j*W)); subplot(3,1,2); % plot |X(W)| plot(W,abs(X)); xlabel('WMATLAB Plot Generated:'); ylabel('|X(W)|'); title('Magnitude (Amplitude) Spectra of x[n]'); gtext('1/(1-.5)'); gtext('1/(1+.5)'); subplot(3,1,3); % plot /_X(W) plot(W,angle(X)*180/pi); xlabel('W '); ylabel('Angle(X(W)) '); title('Phase Spectra of x[n]');