数字信号处理实验2.docx

上传人:b****3 文档编号:4053627 上传时间:2023-05-06 格式:DOCX 页数:40 大小:1.27MB
下载 相关 举报
数字信号处理实验2.docx_第1页
第1页 / 共40页
数字信号处理实验2.docx_第2页
第2页 / 共40页
数字信号处理实验2.docx_第3页
第3页 / 共40页
数字信号处理实验2.docx_第4页
第4页 / 共40页
数字信号处理实验2.docx_第5页
第5页 / 共40页
数字信号处理实验2.docx_第6页
第6页 / 共40页
数字信号处理实验2.docx_第7页
第7页 / 共40页
数字信号处理实验2.docx_第8页
第8页 / 共40页
数字信号处理实验2.docx_第9页
第9页 / 共40页
数字信号处理实验2.docx_第10页
第10页 / 共40页
数字信号处理实验2.docx_第11页
第11页 / 共40页
数字信号处理实验2.docx_第12页
第12页 / 共40页
数字信号处理实验2.docx_第13页
第13页 / 共40页
数字信号处理实验2.docx_第14页
第14页 / 共40页
数字信号处理实验2.docx_第15页
第15页 / 共40页
数字信号处理实验2.docx_第16页
第16页 / 共40页
数字信号处理实验2.docx_第17页
第17页 / 共40页
数字信号处理实验2.docx_第18页
第18页 / 共40页
数字信号处理实验2.docx_第19页
第19页 / 共40页
数字信号处理实验2.docx_第20页
第20页 / 共40页
亲,该文档总共40页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

数字信号处理实验2.docx

《数字信号处理实验2.docx》由会员分享,可在线阅读,更多相关《数字信号处理实验2.docx(40页珍藏版)》请在冰点文库上搜索。

数字信号处理实验2.docx

数字信号处理实验2

实验2

离散时间系统的时域表示

2.1模拟的离散时间系统

p2_1代码如下:

%ProgramP2_1

%SimulationofanM-pointMovingAverageFilter

%Generatetheinputsignal

n=0:

100;

s1=cos(2*pi*0.05*n);%Alow-frequencysinusoid

s2=cos(2*pi*0.47*n);%Ahighfrequencysinusoid

x=s1+s2;

%Implementationofthemovingaveragefilter

M=input('Desiredlengthofthefilter=');

num=ones(1,M);

y=filter(num,1,x)/M;

%Displaytheinputandoutputsignals

clf;

subplot(2,2,1);

plot(n,s1);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('Signal#1');

subplot(2,2,2);

plot(n,s2);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('Signal#2');

subplot(2,2,3);

plot(n,x);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('InputSignal');

subplot(2,2,4);

plot(n,y);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('OutputSignal');

axis;

回答:

Q2.1令M=2,运行上述程序,生成输出信号。

输入x【n】的哪个分量被离散时间系统控制:

频率

Q2.2线性时不变系统改为y[n]=0.5(x[n]–x[n–1])对x[n]=s1[n]+s2[n]的影响:

造成的结果是-该系统现在是一个高通滤波器。

它通过高频率的输入分量S2,而不是低频分量输入S1。

Q2.3程序p2_1运行以下值滤波器长度m和以下的正弦信号S1[n]和S2[n]的频率¬频率值。

输出产生这些不同的m值和频率如下所示。

从这些图中我们提出以下意见–

f1=0.05;f2=0.47;M=15

Q2.4修改程序p2_1通过改变输入序列的扫频正弦信号(长度为101,最小频率为0,和最大频率0.5)作为输入信号(见程序p1_7)如下:

%ProgramP1_7

%Generationofasweptfrequencysinusoidalsequence

n=0:

100;

a=pi/2/100;

b=0;

arg=a*n.*n+b*n;

x=cos(arg);

%ProgramP2_1

%SimulationofanM-pointMovingAverageFilter

%Generatetheinputsignal

%Implementationofthemovingaveragefilter

M=input('Desiredlengthofthefilter=');

num=ones(1,M);

y=filter(num,1,x)/M;

%Displaytheinputandoutputsignals

clf;

subplot(2,2,1);

plot(n,s1);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('Signal#1');

subplot(2,2,2);

plot(n,s2);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('Signal#2');

subplot(2,2,3);

plot(n,x);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('InputSignal');

subplot(2,2,4);

plot(n,y);

axis([0,100,-2,2]);

xlabel('Timeindexn');ylabel('Amplitude');

title('OutputSignal');

axis;

 

Theoutputsignalgeneratedbyrunningthisprogramisplottedbelow.

The从这个系统的扫频信号的响应问题q2.1和q2.2结果可以解释如下:

我们又看到,该系统是一个低通滤波器。

在图中的左,其输入是一个低频率的正弦曲线,通过对输出无衰减。

作为nincreases,输入的频率上升,增加的衰减是出现在输出。

在q2.1,输入的是一个两个正弦曲线的总和s1ands2withF1=0.05andF2=0.47。

扫频输入q2.4达到在n=10的频率为0.05,那里几乎没有衰减输出所示。

这种“解释“为什么s1was通过系统q2.1。

扫频输入q2.4大约在n=94的频率达到0.47,其中的衰减系统的充实。

这种“解释“为什么s2was几乎完全抑制在输出中q2.1。

没有直接的关系,结果表明上述q2.4和取得的结果有q2.2。

然而,使用频率域的概念(3章)我们可以推测,如果扫频信号输入到系统的[]=0.5(x的[][1]–X),我们会看到什么是如上所示相反的结果。

由于该系统将是一个高通滤波器,将有大量的输出衰减在图表的左边,几乎没有衰减在图表的右侧。

这种“解释“为什么inq2.2低频分量s1was抑制系统的输出,而高频分量s2was过去了。

Project2.3线性和非线性系统

P2_3代码如下:

%ProgramP2_3

%Generatetheinputsequences

clf;

n=0:

40;

a=2;b=-3;

x1=cos(2*pi*0.1*n);

x2=cos(2*pi*0.4*n);

x=a*x1+b*x2;

num=[2.24032.49082.2403];

den=[1-0.40.75];

ic=[00];%Setzeroinitialconditions

y1=filter(num,den,x1,ic);%Computetheoutputy1[n]

y2=filter(num,den,x2,ic);%Computetheoutputy2[n]

y=filter(num,den,x,ic);%Computetheoutputy[n]

yt=a*y1+b*y2;

d=y-yt;%Computethedifferenceoutputd[n]

%Plottheoutputsandthedifferencesignal

subplot(3,1,1)

stem(n,y);

ylabel('Amplitude');

title('OutputDuetoWeightedInput:

a\cdotx_{1}[n]+b\cdotx_{2}[n]');

subplot(3,1,2)

stem(n,yt);

ylabel('Amplitude');

title('WeightedOutput:

a\cdoty_{1}[n]+b\cdoty_{2}[n]');

subplot(3,1,3)

stem(n,d);

xlabel('Timeindexn');ylabel('Amplitude');

title('DifferenceSignal');

Answers:

Q2.7输出Y[N],加权得到的输入,和YT[N],OB¬获得由两个输出Y1和Y2的[][]具有相同的权重相结合,如下图所示随着两个信号之间的差异:

这两个序列–相同的数值舍入

系统是–线性的

Q2.8用三中不同的权系数以及三中不同的输入频率重做习题2.7

1.a=1;b=-1;f1=0.05;f2=0.4;

2.a=10;b=2;f1=0.10;f2=0.25;

3.a=2;b=10;f1=0.15;f2=0.20;

根据图片得出系统是–线性的

Q2.9改变2_3的初始条件-ic=[510];

图像如下-

我们可以得到非零初始条件的系统是–非线性

Q2.10当初始条件非零时重做习题2.8

1.a=1;b=-1;f1=0.05;f2=0.4;

2.a=10;b=2;f1=0.10;f2=0.25;

3.a=2;b=10;f1=0.15;f2=0.20;

根据图像可以得出非零初始条件的系统是–非线性

Q2.11将2_3的系统改为:

y[n]=x[n]x[n–1]

输出序列y1[n],y2[n],和y[n]的图像如下:

比较y[n]和yt[n]我们可以得到两个序列是–不一样的

系统是–非线性

Project2.4Time-invariantandTime-varyingSystems

AcopyofProgramP2_4isgivenbelow:

%ProgramP2_4

%Generatetheinputsequences

clf;

n=0:

40;D=10;a=3.0;b=-2;

x=a*cos(2*pi*0.1*n)+b*cos(2*pi*0.4*n);

xd=[zeros(1,D)x];

num=[2.24032.49082.2403];

den=[1-0.40.75];

ic=[00];%Setinitialconditions

%Computetheoutputy[n]

y=filter(num,den,x,ic);

%Computetheoutputyd[n]

yd=filter(num,den,xd,ic);

%Computethedifferenceoutputd[n]

d=y-yd(1+D:

41+D);

%Plottheoutputs

subplot(3,1,1)

stem(n,y);

ylabel('Amplitude');

title('Outputy[n]');grid;

subplot(3,1,2)

stem(n,yd(1:

41));

ylabel('Amplitude');

title(['OutputduetoDelayedInputx[n?

num2str(D),']']);grid;

subplot(3,1,3)

stem(n,d);

xlabel('Timeindexn');ylabel('Amplitude');

title('DifferenceSignal');grid;

Answers:

Q2.12Theoutputsequencesy[n]andyd[n-10]generatedbyrunningProgramP2_4areshownbelow-

Thesetwosequencesarerelatedasfollows-y[n-10]=yd[n]

系统是–时不变的

Q2.13采用不同的延时变量重做习题2.12

D=2

D=4

D=8

得到两个序列的关系是-y[n-D]=yd[n]

系统是–时不变

Q2.14采用3种不同的输入频率重做习题2.12

1.f1=0.05;f2=0.40;

2.f1=0.10;f2=0.25;

3.f1=0.15;f2=0.20;

我们可以得到两个序列-yd[n]不是经过y[n]经过以为得到的

系统是–时不变

Q2.15在非零的初始条件下重做习题2.14。

系统是–非时变

Q2.16在非零的初始条件下重做2.14

1.f1=0.05;f2=0.40;

2.f1=0.10;f2=0.25;

3.f1=0.15;f2=0.20;

这两个序列的关系是-yd[n]不是经过y[n]经过以为得到的

系统是–非时变

Q2.17将2_4的系统改成:

y[n]=nx[n]+x[n-1]

源代码为:

%ModificationofP2_4toimplementthesystem

%givenby(2.16).

%Generatetheinputsequences

clf;

n=0:

40;D=10;a=3.0;b=-2;

x=a*cos(2*pi*0.1*n)+b*cos(2*pi*0.4*n);

xd=[zeros(1,D)x];

nd=0:

length(xd)-1;

%Computetheoutputy[n]

y=(n.*x)+[0x(1:

40)];

%Computetheoutputyd[n]

yd=(nd.*xd)+[0xd(1:

length(xd)-1)];

%Computethedifferenceoutputd[n]

d=y-yd(1+D:

41+D);

%Plottheoutputs

subplot(3,1,1)

stem(n,y);

ylabel('Amplitude');

title('Outputy[n]');grid;

subplot(3,1,2)

stem(n,yd(1:

41));

ylabel('Amplitude');

title(['OutputduetoDelayedInputx[n-',num2str(D),']']);grid;

subplot(3,1,3)

stem(n,d);

xlabel('Timeindexn');ylabel('Amplitude');

title('DifferenceSignal');grid;

输出序列y[n]andyd[n-10]根据P2_4改编之后得到:

Thesetwosequencesarerelatedasfollows-

2.2线性离散时间系统

项目2.5系统的脉冲响应计算

P2_5的源代码:

%ProgramP2_5

%Computetheimpulseresponsey

clf;

N=40;

num=[2.24032.49082.2403];

den=[1-0.40.75];

y=impz(num,den,N);

%Plottheimpulseresponse

stem(y);

xlabel('Timeindexn');ylabel('Amplitude');

title('ImpulseResponse');grid;

Answers:

Q2.19运行2.5得到的图像:

Q2.20修改P2_5的程序产生因果线性时不变系统的冲击响应的前45个样本:

y[n]+0.71y[n-1]–0.46y[n-2]–0.62y[n-3]

=0.9x[n]–0.45x[n-1]+0.35x[n-2]+0.002x[n-3]

clf;

N=45;

num=[0.9-0.450.350.002];

den=[1.00.71-0.46-0.62];

y=impz(num,den,N);

%Plottheimpulseresponse

stem(y);

xlabel('Timeindexn');ylabel('Amplitude');

title('ImpulseResponse');grid;

Q2.21利用filter命令编写一个程序生成因果线性时不变系统的冲击响应并画出前40个样本:

%ProgramQ2_21

%Computetheimpulseresponsey

clf;

N=40;

num=[0.9-0.450.350.002];

den=[1.00.71-0.46-0.62];

%input:

unitpulse

x=[1zeros(1,N-1)];

%output

y=filter(num,den,x);

%Plottheimpulseresponse

%NOTE:

thetimeaxiswillbeWRONG;h[0]will

%beplottedatn=1;butthiswillagreewith

%theINCORRECTplottingthatwasalsodone

%byprogramP2_5.

stem(y);

xlabel('Timeindexn');ylabel('Amplitude');

title('ImpulseResponse');grid;

前40个样本结果如下:

和问题2.20比较,两个序列是-一样

Q2.22MATLAB程序生成和绘制一个LTI因果系统的阶跃响应是表示如下:

%ProgramQ2_22

%Computethestepresponses

clf;

N=40;

n=0:

N-1;

num=[2.24032.49082.2403];

den=[1.0-0.40.75];

%input:

unitstep

x=[ones(1,N)];

%output

y=filter(num,den,x);

%Plotthestepresponse

stem(n,y);

xlabel('Timeindexn');ylabel('Amplitude');

title('StepResponse');grid;

图像:

项目2.6LTI系统的级联

P2_6的源代码:

%ProgramP2_6

%CascadeRealization

clf;

x=[1zeros(1,40)];%Generatetheinput

n=0:

40;

%Coefficientsof4thordersystem

den=[11.62.281.3250.68];

num=[0.06-0.190.27-0.260.12];

%Computetheoutputof4thordersystem

y=filter(num,den,x);

%Coefficientsofthetwo2ndordersystems

num1=[0.3-0.20.4];den1=[10.90.8];

num2=[0.2-0.50.3];den2=[10.70.85];

%Outputy1[n]ofthefirststageinthecascade

y1=filter(num1,den1,x);

%Outputy2[n]ofthesecondstageinthecascade

y2=filter(num2,den2,y1);

%Differencebetweeny[n]andy2[n]

d=y-y2;

%Plotoutputanddifferencesignals

subplot(3,1,1);

stem(n,y);

ylabel('Amplitude');

title('Outputof4thorderRealization');grid;

subplot(3,1,2);

stem(n,y2)

ylabel('Amplitude');

title('OutputofCascadeRealization');grid;

subplot(3,1,3);

stem(n,d)

xlabel('Timeindexn');ylabel('Amplitude');

title('DifferenceSignal');grid;

回答:

Q2.23输出序列y[n],y2[n],不同信号d[n]根据P2_6:

y[n],y2[n]的关系是-他们是相同的数值舍入。

Q2.24将输入改成正弦序列重做2.23:

y[n]和y2[n]在这里的关系是-他们是相同的数值舍入。

Q2.25用任意的非零初始向量来重做习题2.23:

y[n]和y2[n]在这里的关系式-一样的

Q2.26修改程序2.6,将2个二阶系统顺序颠倒并零初始条件下重复此过程:

%ProgramQ2_26

%CascadeRealization

clf;

x=[1zeros(1,40)];%Generatetheinput

n=0:

40;

%Coefficientsof4thordersystem

den=[11.62.281.3250.68];

num=[0.06-0.190.27-0.260.12];

%Computetheoutputof4thordersystem

y=filter(num,den,x);

%Coefficientsofthetwo2ndordersystems

num1=[0.3-0.20.4];den1=[10.90.8];

num2=[0.2-0.50.3];den2=[10.7

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2