数字信号处理第二版(实验二) 信号的采样与重建

实验二 信号的采样与重建

一,实验目的

(1)通过观察采样信号的混叠现象,进一步理解奈奎斯特采样频率的意义。

(2)通过实验,了解数字信号采样转换过程中的频率特征。 (3)对实际的 音频文件作内插和抽取操作,体会低通滤波器在内插和抽取中的作用。 二,实验内容

(1)采样混叠,对一个模拟信号Va(t)进行等间采样,采样频率为200HZ ,得到离散时间信号V(n).Va(t )由频率为30Hz,150Hz,170Hz,250Hz,330Hz 的5个正弦信号的加权和构成。 Va(t)=6cos(60pi*t)+3sin(300pi*t)+2cos(340pi*t)+4cos(500pi*t)+10sin(660pi*t)观察采样后信号的混叠效应。 程序:clear,

close all , t=0:0.1:20; Ts=1/2; n=0:Ts:20;

V=8*cos(0.3*pi*t)+5*cos(0.5*pi*t+0.6435)-10*sin(0.7*pi*t); Vn=8*cos(0.3*pi*n)+5*cos(0.5*pi*n+0.6435)-10*sin(0.7*pi*n); subplot(221) plot(t,V), grid on ,

subplot(222) stem(n,Vn,'.' ), grid on ,

4020

0-20-40

[**************]0

(2)输入信号X(n)为归一化频率f1=0.043,f2=0.31的两个正弦信号相加而成,N=100,按因子M=2作抽取:(1)不适用低通滤波器;(2)使用低通滤波器。分别显示输入输出序列在时域和频域中的特性。 程序:clear;

N=100; M=2;

f1=0.043; f2=0.31; n=0:N-1;

x=sin(2*pi*f1*n)+sin(2*pi*f2*n); y1=x(1:2:100);

y2=decimate(x,M,'fir' ); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n' );ylabel('fudu' ); figure(2); n=0:N/2-1; stem(n,y1);

title('output sequence without LP'); xlabel('n' );ylabel('fudu' ); figure(3); m=0:N/M-1;

stem(m,y2(1:N/M));

title('output sequence with LP'); xlabel('n' );ylabel('fudu' ); figure(4);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w' );ylabel('fudu' ); figure(5);

[h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence without LP'); xlabel('w' );ylabel('fudu' ); figure(6);

[h,w]=freqz(y2);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence without LP'); xlabel('w' );ylabel('fudu' );

input sequence

f u d u

010203040

50n

[1**********]

output sequence without LP

f u d u

05101520

25n

3035404550

output sequence with LP

f u d u

05101520

25n

303540

4550

frequency spectrum of the input sequence

5045

403530f u d u

[1**********]

0.5

1

1.5

w

frequency spectrum of the output sequence without LP

30

2

2.5

3

3.5

25

20

f u d u

15

10

5

00.511.5

w

22.533.5

frequency spectrum of the output sequence without LP

25

20

15f u d u

10

5

00.511.5

w

22.533.5

(3)输入信号X(n)为归一化频率f1=0.043,f2=0.31的两个正弦信号相加而成,长度N=50,内插因子为2. (1)不适用低通滤波器;(2)使用低通滤波器。分别显示输入输出序列在时域和频域中的特性。 程序:clear,

close all , N=50; L=2;

f1=0.043; f2=0.31; n=0:N-1;

x=sin(2*pi*f1*n)+sin(2*pi*f2*n); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n' );ylabel('fudu' ); y1=zeros(1,N*2); y1(1:2:N*2)=x; figure(2); m=0:N*L-1;

stem(m,y1(1:N*L));

title('output sequence '); xlabel('n' );ylabel('fudu' ); y2=interp(x,L); figure(3); m=0:N*L-1;

stem(m,y2(1:N*L));

title('output sequence'); xlabel('n' );ylabel('fudu' ); figure(4);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w' );ylabel('fudu' ); figure(5);

[h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence'); xlabel('w' );ylabel('fudu' ); figure(6);

[h,w]=freqz(y2);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence '); xlabel('w' );ylabel('fudu' );

f u d u

05101520

25n

3035404550

output sequence

f u d u

010203040

50n

[1**********]

f u d u

10

20

30

40

50n

60

70

80

90

100

frequency spectrum of the input sequence

30

25

20

f u d u

15

10

5

00.511.5

w

22.533.5

frequency spectrum of the output sequence

30

25

20

f u d u

15

10

5

00.511.5

w

22.533.5

frequency spectrum of the output sequence

60

50

40

f u d u

30

20

10

00.511.5

w

22.533.5

二.(3)令x(n)=cos(2*pi*f*n/fs),其中f/fs=1/16,即每个周期内有16个点。试用MATLAB 编程实现:

1). 作M=4倍的抽取,使每个周期变成4点。 程序:clear, close all, N=100; M=4; n=0:N-1;

x=cos(2*pi*n*(1/16));

stem(n,x(1:N)); title('input sequence'); xlabel('n');ylabel('fudu'); y1=x(1:4:100); y2=decimate(x,M,'fir'); figure(2); m=0:N/4-1; stem(m,y1);

title('output sequence '); xlabel('n');ylabel('fudu'); figure(3); m=0:N/M-1; stem(m,y2(1:N/M));

title('output sequence'); xlabel('n');ylabel('fudu'); figure(4); [h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w');ylabel('fudu'); figure(5); [h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence'); xlabel('w');ylabel('fudu'); figure(6); [h,w]=freqz(y2);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence '); xlabel('w');ylabel('fudu');

f u d u

n

f u d u

n

output sequence

f u d u

0510

n

152025

60

frequency spectrum of the input sequence

50

40

f u d u

30

20

10

00.511.5

w

22.533.5

1412

108

frequency spectrum of the output sequence

f u d u

64200

0.511.5

w

22.533.5

1412

108

frequency spectrum of the output sequence

f u d u

64200

0.511.5

w

22.533.5

2). 作L=3倍的插值,使每个周期变成48点。 程序:clear, close all, N=50;

L=3; n=0:N-1;

x=cos(2*pi*n*(1/16)); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n');ylabel('fudu'); y1=zeros(1,N*3); y1(1:3:N*3)=x; figure(2); m=0:N*3-1;

stem(m,y1(1:N*3)); title('output sequence '); xlabel('n');ylabel('fudu'); y2=interp(x,L); figure(3);

m=0:5:N*L-1;

stem(m,y2(1:5:N*L)); title('output sequence'); xlabel('n');ylabel('fudu'); figure(4);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w');ylabel('fudu'); figure(5);

[h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence'); xlabel('w');ylabel('fudu'); figure(6);

[h,w]=freqz(y2);

plot(w(1:64),abs(h(1:64)));

title('frequency spectrum of the output sequence '); xlabel('w');ylabel('fudu');

f u d u

n

f u d u

n

output sequence

f u d u

050

n

100150

frequency spectrum of the input sequence

f u d u

00.511.5

w

22.533.5

frequency spectrum of the output sequence

f u d u

00.511.5

w

22.533.5

frequency spectrum of the output sequence

f u d u

00.050.10.15

0.2w

0.250.30.350.4

(4).输入信号x(n)为归一化频率分别是f1=0.04,f2=0.3的正弦信号相加而成,N=50,内插因子为5,抽取因子为3, 给出按有理因子5/3做采样率转换的输入输出波形。 程序:clear, close all,

N=50; M=3; L=5; f1=0.04; f2=0.3; n=0:N-1;

x=sin(2*pi*f1*n)+sin(2*pi*f2*n); y=resample(x,L,M); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n');ylabel('fudu'); figure(2); m=0:N-1;

stem(m,y(1:N));

title('output sequence '); xlabel('n');ylabel('fudu'); figure(3);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w');ylabel('fudu'); figure(4);

[h,w]=freqz(y);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence '); xlabel('w');ylabel('fudu');

input sequence

f u d u 01020

n 304050

output sequence

f u d u n

30frequency spectrum of the input sequence25

20

f u d u 15

10

5

000.511.5

w 22.533.5

45

40

35

30

25

20

15

10

5

000.5frequency spectrum of the output sequence f u d u 11.5

w 22.533.5

实验二 信号的采样与重建

一,实验目的

(1)通过观察采样信号的混叠现象,进一步理解奈奎斯特采样频率的意义。

(2)通过实验,了解数字信号采样转换过程中的频率特征。 (3)对实际的 音频文件作内插和抽取操作,体会低通滤波器在内插和抽取中的作用。 二,实验内容

(1)采样混叠,对一个模拟信号Va(t)进行等间采样,采样频率为200HZ ,得到离散时间信号V(n).Va(t )由频率为30Hz,150Hz,170Hz,250Hz,330Hz 的5个正弦信号的加权和构成。 Va(t)=6cos(60pi*t)+3sin(300pi*t)+2cos(340pi*t)+4cos(500pi*t)+10sin(660pi*t)观察采样后信号的混叠效应。 程序:clear,

close all , t=0:0.1:20; Ts=1/2; n=0:Ts:20;

V=8*cos(0.3*pi*t)+5*cos(0.5*pi*t+0.6435)-10*sin(0.7*pi*t); Vn=8*cos(0.3*pi*n)+5*cos(0.5*pi*n+0.6435)-10*sin(0.7*pi*n); subplot(221) plot(t,V), grid on ,

subplot(222) stem(n,Vn,'.' ), grid on ,

4020

0-20-40

[**************]0

(2)输入信号X(n)为归一化频率f1=0.043,f2=0.31的两个正弦信号相加而成,N=100,按因子M=2作抽取:(1)不适用低通滤波器;(2)使用低通滤波器。分别显示输入输出序列在时域和频域中的特性。 程序:clear;

N=100; M=2;

f1=0.043; f2=0.31; n=0:N-1;

x=sin(2*pi*f1*n)+sin(2*pi*f2*n); y1=x(1:2:100);

y2=decimate(x,M,'fir' ); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n' );ylabel('fudu' ); figure(2); n=0:N/2-1; stem(n,y1);

title('output sequence without LP'); xlabel('n' );ylabel('fudu' ); figure(3); m=0:N/M-1;

stem(m,y2(1:N/M));

title('output sequence with LP'); xlabel('n' );ylabel('fudu' ); figure(4);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w' );ylabel('fudu' ); figure(5);

[h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence without LP'); xlabel('w' );ylabel('fudu' ); figure(6);

[h,w]=freqz(y2);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence without LP'); xlabel('w' );ylabel('fudu' );

input sequence

f u d u

010203040

50n

[1**********]

output sequence without LP

f u d u

05101520

25n

3035404550

output sequence with LP

f u d u

05101520

25n

303540

4550

frequency spectrum of the input sequence

5045

403530f u d u

[1**********]

0.5

1

1.5

w

frequency spectrum of the output sequence without LP

30

2

2.5

3

3.5

25

20

f u d u

15

10

5

00.511.5

w

22.533.5

frequency spectrum of the output sequence without LP

25

20

15f u d u

10

5

00.511.5

w

22.533.5

(3)输入信号X(n)为归一化频率f1=0.043,f2=0.31的两个正弦信号相加而成,长度N=50,内插因子为2. (1)不适用低通滤波器;(2)使用低通滤波器。分别显示输入输出序列在时域和频域中的特性。 程序:clear,

close all , N=50; L=2;

f1=0.043; f2=0.31; n=0:N-1;

x=sin(2*pi*f1*n)+sin(2*pi*f2*n); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n' );ylabel('fudu' ); y1=zeros(1,N*2); y1(1:2:N*2)=x; figure(2); m=0:N*L-1;

stem(m,y1(1:N*L));

title('output sequence '); xlabel('n' );ylabel('fudu' ); y2=interp(x,L); figure(3); m=0:N*L-1;

stem(m,y2(1:N*L));

title('output sequence'); xlabel('n' );ylabel('fudu' ); figure(4);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w' );ylabel('fudu' ); figure(5);

[h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence'); xlabel('w' );ylabel('fudu' ); figure(6);

[h,w]=freqz(y2);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence '); xlabel('w' );ylabel('fudu' );

f u d u

05101520

25n

3035404550

output sequence

f u d u

010203040

50n

[1**********]

f u d u

10

20

30

40

50n

60

70

80

90

100

frequency spectrum of the input sequence

30

25

20

f u d u

15

10

5

00.511.5

w

22.533.5

frequency spectrum of the output sequence

30

25

20

f u d u

15

10

5

00.511.5

w

22.533.5

frequency spectrum of the output sequence

60

50

40

f u d u

30

20

10

00.511.5

w

22.533.5

二.(3)令x(n)=cos(2*pi*f*n/fs),其中f/fs=1/16,即每个周期内有16个点。试用MATLAB 编程实现:

1). 作M=4倍的抽取,使每个周期变成4点。 程序:clear, close all, N=100; M=4; n=0:N-1;

x=cos(2*pi*n*(1/16));

stem(n,x(1:N)); title('input sequence'); xlabel('n');ylabel('fudu'); y1=x(1:4:100); y2=decimate(x,M,'fir'); figure(2); m=0:N/4-1; stem(m,y1);

title('output sequence '); xlabel('n');ylabel('fudu'); figure(3); m=0:N/M-1; stem(m,y2(1:N/M));

title('output sequence'); xlabel('n');ylabel('fudu'); figure(4); [h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w');ylabel('fudu'); figure(5); [h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence'); xlabel('w');ylabel('fudu'); figure(6); [h,w]=freqz(y2);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence '); xlabel('w');ylabel('fudu');

f u d u

n

f u d u

n

output sequence

f u d u

0510

n

152025

60

frequency spectrum of the input sequence

50

40

f u d u

30

20

10

00.511.5

w

22.533.5

1412

108

frequency spectrum of the output sequence

f u d u

64200

0.511.5

w

22.533.5

1412

108

frequency spectrum of the output sequence

f u d u

64200

0.511.5

w

22.533.5

2). 作L=3倍的插值,使每个周期变成48点。 程序:clear, close all, N=50;

L=3; n=0:N-1;

x=cos(2*pi*n*(1/16)); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n');ylabel('fudu'); y1=zeros(1,N*3); y1(1:3:N*3)=x; figure(2); m=0:N*3-1;

stem(m,y1(1:N*3)); title('output sequence '); xlabel('n');ylabel('fudu'); y2=interp(x,L); figure(3);

m=0:5:N*L-1;

stem(m,y2(1:5:N*L)); title('output sequence'); xlabel('n');ylabel('fudu'); figure(4);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w');ylabel('fudu'); figure(5);

[h,w]=freqz(y1);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence'); xlabel('w');ylabel('fudu'); figure(6);

[h,w]=freqz(y2);

plot(w(1:64),abs(h(1:64)));

title('frequency spectrum of the output sequence '); xlabel('w');ylabel('fudu');

f u d u

n

f u d u

n

output sequence

f u d u

050

n

100150

frequency spectrum of the input sequence

f u d u

00.511.5

w

22.533.5

frequency spectrum of the output sequence

f u d u

00.511.5

w

22.533.5

frequency spectrum of the output sequence

f u d u

00.050.10.15

0.2w

0.250.30.350.4

(4).输入信号x(n)为归一化频率分别是f1=0.04,f2=0.3的正弦信号相加而成,N=50,内插因子为5,抽取因子为3, 给出按有理因子5/3做采样率转换的输入输出波形。 程序:clear, close all,

N=50; M=3; L=5; f1=0.04; f2=0.3; n=0:N-1;

x=sin(2*pi*f1*n)+sin(2*pi*f2*n); y=resample(x,L,M); figure(1);

stem(n,x(1:N));

title('input sequence'); xlabel('n');ylabel('fudu'); figure(2); m=0:N-1;

stem(m,y(1:N));

title('output sequence '); xlabel('n');ylabel('fudu'); figure(3);

[h,w]=freqz(x);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the input sequence'); xlabel('w');ylabel('fudu'); figure(4);

[h,w]=freqz(y);

plot(w(1:512),abs(h(1:512)));

title('frequency spectrum of the output sequence '); xlabel('w');ylabel('fudu');

input sequence

f u d u 01020

n 304050

output sequence

f u d u n

30frequency spectrum of the input sequence25

20

f u d u 15

10

5

000.511.5

w 22.533.5

45

40

35

30

25

20

15

10

5

000.5frequency spectrum of the output sequence f u d u 11.5

w 22.533.5


相关文章

  • 北邮通原硬件实验报告
  • 2013年通信原理硬件实验报告 学 院:信息与通信工程学院 班 级:2011211104 姓 名: 学 号: 班内序号: 组 号: 同 组 人: 1 目录 实验一:双边带抑制载波调幅(DSB-SC AM).................. ...查看


  • 压缩感知技术综述
  • 压缩感知技术综述 摘要:信号采样是模拟的物理世界通向数字的信息世界之必备手段.多年来,指导信号采样的理论基础一直是著名的Nyquist 采样定理,但其产生的大量数据造成了存储空间的浪费.压缩感知(Compressed Sensing )提出 ...查看


  • 微弱信号检测技术专题
  • 第27卷 第3期2005年6月 电气电子教学学报JOURNALOFEEE Vol.27No.3 Jun.2005 微弱信号检测技术综合专题实验 卢荣德,杜英磊 中国科学技术大学( 摘 *天文及应用物理系,安徽合肥230026) 要:本文基于 ...查看


  • 在线转子振动参数的光电检测
  • DOI :10. 13741/j . cn ki . 11-1879/o4. 2006. 04. 025 第32卷第4期V ol . 32No . 4 2006年7月OP T ICA L T ECHN IQ U E July 2006 光学 ...查看


  • 1频谱就是频率的分布曲线
  • 信号采集 1频谱就是频率的分布曲线,复杂振荡分解为振幅不同和频率不同的谐振荡,这些谐振荡的幅值按频率排列的图形叫做频谱.广泛应用在声学.光学和无线电技术等方面. 频谱是频率谱密度的简称.它将对信号的研究从时域引到频域,从而带来更直观的认识. ...查看


  • 数字滤波器毕业论文
  • 摘 要 本文介绍了数字滤波器.IIR 数字滤波器的设计和内插技术及用MA TLAB 工具箱进行IIR 数字滤波器的设计和内插程序的实现.本文介绍了IIR 数字滤波器的三种设计方法,即脉冲响应不变法,双线性变换法和一种IIR 数字滤波器的优化 ...查看


  • 数字语音处理
  • 数字语音处理 摘 要 语音信号处理包括语音通信.语音增强.语音合成.语音识别和说话人识别等方面.只有通过语音信号的数字处理,语音信号的好坏.语音识别率的高低,都取决于语音信号处理的好坏.因此,语音信号处理是一项非常有意义的研究课程. 语音, ...查看


  • 示波器的使用实验报告
  • 实验一 通用模拟与数字双踪示波器的使用及测量 一.实验目的和要求 1. 根据已学的示波器理论知识学习正确使用通用双踪示波器,并利用示波器进行各种电信号的测量,熟练掌握模拟示波器的使用. 2. 学习数字式通用示波器的使用,了解其在测量上的强大 ...查看


  • 贪婪算法与压缩感知理论
  • 第37卷第12期2011年12月 自动化学报 ACTA AUTOMATICA SINICA Vol. 37, No. 12December, 2011 贪婪算法与压缩感知理论 方红1 杨海蓉2 摘要贪婪算法以其重建速度快.重建方法实现简便的 ...查看


热门内容