当前位置:文档之家› 数字信号处理第三章汇总

数字信号处理第三章汇总

数字信号处理第三章实验程序3.1计算离散时间傅里叶变换% Program P3_1% Evaluation of the DTFTclf;% Compute the frequency samples of the DTFTw = -4*pi:8*pi/511:4*pi;num = [2 1];den = [1 -0.6];h = freqz(num, den, w);% Plot the DTFTsubplot(2,1,1)plot(w/pi,real(h));gridtitle('Real part of H(e^{j\omega})')xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,1,2)plot(w/pi,imag(h));gridtitle('Imaginary part of H(e^{j\omega})')xlabel('\omega /\pi');ylabel('Amplitude');pausesubplot(2,1,1)plot(w/pi,abs(h));gridtitle('Magnitude Spectrum |H(e^{j\omega})|')xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,1,2)plot(w/pi,angle(h));gridtitle('Phase Spectrum arg[H(e^{j\omega})]')xlabel('\omega /\pi');ylabel('Phase in radians');Q3.1离散时间傅里叶变换的原始序列是H(e^jw)=(2+z^-1)/(1-0.6z^-1)。

Pause的作用是暂停等待用户输入任意键后接着执行以下命令。

Q3.2是周期函数,周期是2π。

实部和幅度谱是关于y 轴对称,是偶函数;虚部和相位谱是关于原点对称,是奇函数。

Q3.3 clf; N = 512;num = [0.7 -0.5 0.3 1]; den = [1 0.3 -0.5 0.7]; [h,w] = freqz(num, den, N); subplot(2,1,1)plot(w/pi,real(h));gridtitle('Real part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,1,2)plot(w/pi,imag(h));gridtitle('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); pausesubplot(2,1,1)plot(w/pi,abs(h));gridtitle('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,1,2)plot(w/pi,angle(h));gridtitle('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi');ylabel('Phase in radians');还是周期函数,周期是2π。

相位谱的跳变的原因是:在利用反正切函数计算角度的时候,其中的一个分支出现了衰减,造成了跳变。

clf;N = 512;num = [0.7 -0.5 0.3 1];den = [1 0.3 -0.5 0.7];[h,w] = freqz(num, den, N);subplot(2,1,1)plot(w/pi,unwrap(angle(h)));gridtitle('Phase Spectrum arg[H(e^{j\omega})]')xlabel('\omega /\pi');ylabel('Phase in radians');Q3.4 修改后的程序为clf;w = -4*pi:8*pi/511:4*pi;num = [1 3 5 7 9 11 13 15 17];den = 1;h = freqz(num, den, w);% Plot the DTFTsubplot(2,1,1)plot(w/pi,real(h));gridtitle('Real part of H(e^{j\omega})')xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,1,2)plot(w/pi,imag(h));gridtitle('Imaginary part of H(e^{j\omega})')xlabel('\omega /\pi');ylabel('Amplitude');pausesubplot(2,1,1)plot(w/pi,abs(h));gridtitle('Magnitude Spectrum |H(e^{j\omega})|')xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,1,2)plot(w/pi,angle(h));gridtitle('Phase Spectrum arg[H(e^{j\omega})]')xlabel('\omega /\pi');ylabel('Phase in radians');是周期函数,周期是2π。

实部和幅度谱是关于y轴对称,是偶函数;虚部和相位谱是关于原点对称,是奇函数。

Q3.5若要改为以度为单位,则将程序中的第二个图的程序改为subplot(2,1,2)plot(w/pi,180*angle(h)/pi);gridtitle('Phase Spectrum arg[H(e^{j\omega})]')xlabel('\omega /\pi');ylabel('Phase in degrees');就可以了。

3.2离散时间傅里叶变换的性质1.时移特性clf;w = -pi:2*pi/255:pi;D = 10;num = [1 2 3 4 5 6 7 8 9];h1 = freqz(num, 1, w);h2 = freqz([zeros(1,D) num], 1, w);subplot(2,2,1)plot(w/pi,abs(h1));gridtitle('Magnitude Spectrum of Original Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,2,2)plot(w/pi,abs(h2));gridtitle('Magnitude Spectrum of Time-Shifted Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,2,3)plot(w/pi,angle(h1));gridtitle('Phase Spectrum of Original Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Phase in radians');subplot(2,2,4)plot(w/pi,angle(h2));gridtitle('Phase Spectrum of Time-Shifted Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Phase in radians');Q3.6参数D控制时移量。

Q3.7D=10 D=50时移特性:信号在时域移动某个距离,则所得信号的幅度谱和原信号相同,而相位谱是原信号的相位谱再附加一个线性相移,由时移特性可以看到,信号的相位谱可以反映信号在时域中的位置信息,不同位置上的同一信号,它们具有不同的相频特性,而幅频特性相同。

Q3.8如上图所示Q3.9改变序列长度num = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2425 26 27 28 29];所得的图像为D=10 D=50从上图中可以看出,增加序列的长度,使得幅度谱更加窄,而相位谱则更加密集和陡峭。

2.平移特性Q3.10clf;w = -pi:2*pi/255:pi;wo = 0.4*pi;num1 = [1 3 5 7 9 11 13 15 17];L = length(num1);h1 = freqz(num1, 1, w);n = 0:L-1;num2 = exp(wo*i*n).*num1;h2 = freqz(num2, 1, w);subplot(2,2,1)plot(w/pi,abs(h1));gridtitle('Magnitude Spectrum of Original Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,2,2)plot(w/pi,abs(h2));gridtitle('Magnitude Spectrum of Frequency-Shifted Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,2,3)plot(w/pi,angle(h1));gridtitle('Phase Spectrum of Original Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Phase in radians');subplot(2,2,4)plot(w/pi,angle(h2));gridtitle('Phase Spectrum of Frequency-Shifted Sequence','FontSize',8)xlabel('\omega /\pi');ylabel('Phase in radians');Wo控制平移量。

相关主题