修改程序后的运行结果为:
100Real part of H(e)j?Amplitude500-50-4-3-2-10? /?1234100j?Imaginary part of H(e)Amplitude500-50-100-4-3-2-10? /?1234
100Magnitude Spectrum |H(e)|j?Amplitude500-4-3-2-10? /?12344Phase Spectrum arg[H(ej?)]Phase in radians20-2-4-4-3-2-10? /?1234
DTFT 是关于 ?的周期函数么? 答:DTFT 是关于 ?的周期函数。 周期是 - 2?
相位谱中跳变的原因是 - 角度返回到arctan的本值
实验名称:离散傅立叶变换和z变换
实验目的和任务:
掌握离散傅立叶变换(DFT)及逆变换(IDFT)、z变换及逆变换的计算和分析。利用Matlab语言,完成DFT和IDFT的计算及常用性质的验证,用DFT实现线性卷积,实现z变换的零极点分析,求有理逆z变换。
实验内容:
DFT和IDFT计算: Q3.23~3.24
DFT的性质: Q3.26~3.29,Q3.36,Q3.38,Q3.40 z变换分析:Q3.46~3.48 逆z变换:Q3.50
实验过程与结果分析:
Q3.23 编写一个MATLAB程序,计算并画出长度为N的L点离散傅里叶变换X[k]的值,其中L≥N,然后计算并画出L点离散傅里叶变换X[k]。对不同长度N和不同的离散傅里叶变换长度L,运行程序。讨论你的结果。
编写的MATLAB程序:
% Program Q3.23
% Compute and plot the L-point DFT of an N-point signal, L >= N. clf;
%Initialize
N=200; % length of signal L=256; % length of DFT nn = [0:N-1]; kk = [0:L-1]; % the signal x
xR = [0.1*(1:100) zeros(1,N-100)]; % real part xI = [zeros(1,N)]; % imag part x = xR + i*xI; % DFT
XF = fft(x,L); % plot xR and xI subplot(3,2,1);grid; plot(nn,xR);grid; title('Re\\{x[n]\\}'); xlabel('Time index n'); ylabel('Amplitude'); subplot(3,2,2); plot(nn,xI);grid; title('Im\\{x[n]\\}'); xlabel('Time index n'); ylabel('Amplitude');
% plot real and imag parts of DFT subplot(3,2,3);
plot(kk,real(XF));grid; title('Re\\{X[k]\\}');
xlabel('Frequency index k'); ylabel('Amplitude'); subplot(3,2,4);
plot(kk,imag(XF));grid; title('Im\\{X[k]\\}');
xlabel('Frequency index k'); ylabel('Amplitude'); % IDFT
xx = ifft(XF,L);
% plot real and imaginary parts of the IDFT subplot(3,2,5);
plot(kk,real(xx));grid;
title('Real part of IDFT\\{X[k]\\}'); xlabel('Time index n'); ylabel('Amplitude'); subplot(3,2,6);
plot(kk,imag(xx));grid;
title('Imag part of IDFT\\{X[k]\\}'); xlabel('Time index n'); ylabel('Amplitude');
Re{x[n]}Im{x[n]}Amplitude500100Time index nRe{X[k]}200Amplitude1010-10Amplitude0-10000100200300Frequency index kReal part of IDFT{X[k]}Amplitude10005000-5000100Time index nIm{X[k]}200Amplitude0-100100200Time index n300Amplitude1010-10100200300Frequency index kImag part of IDFT{X[k]}100200Time index n300
Q3.24 写一个MATLAB程序,用一个N点复数离散傅里叶计算两个长度为N的实数序列的N点离散傅里叶变换,,并将结果同直接使用两个N点离散傅里叶变换得到的结果进行比较。
编写的MATLAB程序:
% Program Q3.24
% Use a single N-point DFT to compute simultaneously the N-point % DFT's of two real-valued N-point sequences. clf; %Initialize
N=256; % length of signal nn = [0:N-1]; ntime = [-N/2:N/2-1];
g = (0.75).^abs(ntime); % signal g h = (-0.9).^ntime; % signal h % DFT's of g and h GF = fft(g); HF = fft(h);
x = g + i*h; % the composite signal x % DFT of composite signal XF = fft(x);
% DFT of g derived from composite DFT XF XFstar = conj(XF);
XFstarmod = [XFstar(1) fliplr(XFstar(2:N))]; GF2 = 0.5*(XF + XFstarmod); HF2 = -i*0.5*(XF - XFstarmod); abs(max(GF-GF2)) abs(max(HF-HF2))
% plot real and imag parts of direct computation of GF figure(1);clf; subplot(2,2,1);grid; plot(nn,real(GF));grid; title('Two N-point DFT''s'); xlabel('Frequency index k'); ylabel('Re\\{G[k]\\}'); subplot(2,2,2);
plot(nn,imag(GF));grid; title('Two N-point DFT''s'); xlabel('Frequency index k'); ylabel('Im\\{G[k]\\}');
% plot real and imag parts of composite computation of GF subplot(2,2,3);grid; plot(nn,real(GF2));grid; title('Single N-point DFT'); xlabel('Frequency index k');
ylabel('Re\\{G[k]\\}'); subplot(2,2,4);
plot(nn,imag(GF2));grid; title('Single N-point DFT'); xlabel('Frequency index k'); ylabel('Im\\{G[k]\\}');
% plot real and imag parts of direct computation of HF figure(2);clf; subplot(2,2,1);grid; plot(nn,real(HF));grid; title('Two N-point DFT''s'); xlabel('Freq index k'); ylabel('Re\\{H[k]\\}'); subplot(2,2,2);
plot(nn,imag(HF));grid; title('Two N-point DFT''s'); xlabel('Freq index k'); ylabel('Im\\{H[k]\\}');
% plot real and imag parts of composite computation of HF subplot(2,2,3);grid; plot(nn,real(HF2));grid; title('Single N-point DFT'); xlabel('Freq index k'); ylabel('Re\\{H[k]\\}'); subplot(2,2,4);
plot(nn,imag(HF2));grid; title('Single N-point DFT'); xlabel('Freq index k'); ylabel('Im\\{H[k]\\}');
Two N-point DFT's-15x 10Two N-point DFT's102Re{G[k]}0-5-100100200Frequency index kSingle N-point DFT300Im{G[k]}510-10-9100200Frequency index k300101x 10Single N-point DFTRe{G[k]}0-5-100100200Frequency index k300Im{G[k]}50.50-0.5-10100200Frequency index k300
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库DSP实验报告(3)在线全文阅读。
相关推荐: