数字信号处理课后作业.docx
《数字信号处理课后作业.docx》由会员分享,可在线阅读,更多相关《数字信号处理课后作业.docx(17页珍藏版)》请在冰点文库上搜索。
数字信号处理课后作业
P2.1利用在本章讨论的基本MATLAB信号函数和基本MATLAB信号运算产生下列序列,并用stem函数画出信号样本。
1.x1(n)=3δ(n+2)+2δ(n)-δ(n-3)+5δ(n-7),-5<=n<=15
2.x3(n)=10μ(n)-5μ(n-5)-10μ(n-10)+5μ(n-15)
>>n=[-5:
15];
>>x1=3*impseq(-2,-5,15)+2*impseq(0,-5,15)-impseq(3,-5,15)+5*impseq(7,-5,15);
>>subplot(2,1,1)
>>stem(n,x1)
>>title('SequenceinProblem2.11')
>>xlabel('n');
>>ylabel('x1(n)')
>>n=[-20:
30];
>>x3=10*stepseq(0,-20,30)-5*stepseq(5,-20,30)-10*stepseq(10,-20,30)+5*stepseq(15,-20,30);
>>subplot(2,1,2);
>>stem(n,x3);
>>title('SequenceinProblem2.13');
>>xlabel('n');
>>ylabel('x3(n)')
P2.4设x(n)={2,4,-3,-1,-5,4,7},产生并画出下列序列的样本(用stem函数)。
1.x1(n)=2x(n-3)+3x(n+4)-x(n)
2.x2(n)=4x(4+n)+5x(n+5)+2x(n)
>>n=[-3:
3];
>>x=[2,4,-3,-1,-5,4,7];
>>[x11,n11]=sigshift(x,n,3);
>>[x12,n12]=sigshift(x,n,-4);
>>[x13,n13]=sigshift(x,n,0);
>>[x1,n1]=sigadd(2*x11,n11,3*x12,n12);
>>[x1,n1]=sigadd(x1,n1,-x13,n13);
>>subplot(2,1,1);
>>stem(n1,x1);
>>title('SequenceinExample2.41');
>>xlabel('n');
>>ylabel('x1(n)')
>>[x21,n21]=sigshift(x,n,-4);
>>[x22,n22]=sigshift(x,n,-5);
>>[x23,n23]=sigshift(x,n,0);
>>[x2,n2]=sigadd(4*x21,n21,5*x22,n22);
>>[x2,n2]=sigadd(x2,n2,2*x23,n23);
>>subplot(2,1,2);
>>stem(n2,x2);
>>title('SequenceinExample2.42');
>>xlabel('n');
>>ylabel('x2(n)');
P2.19一个线性和时不变系统呦下面差分方程描述:
y(n)-0.5y(n-1)+0.25y(n-2)=x(n)+2x(n-1)+x(n-3)
1.利用filter函数计算并画出在0<=n<=100内系统的脉冲响应。
2.从上面的脉冲响应确定稳定系统。
3.如果这个系统的输入是x(n)=[5+3cos(0.2*pi*n)+4sin(0.6*pi*n)]u(n),利用
filter函数求在0<=n<=200内的响应y(n).
⑴>>a=[1,-0.5,0.25];
>>b=[1,2,1];
>>n=[0:
100];
>>x1=[1zeros(1,100)];
>>h=filter(b,a,x1);
>>subplot(2,1,1);
>>stem(n,h);
>>xlabel('n');
>>ylabel('h');
>>title('系统的脉冲响应h(n)');
⑵>>sum(abs(h))
ans=
6.5714
即可以求出∑|h(n)|,所以系统是稳定的。
⑶>>n=[0:
200];
>>x=5*stepseq(0,0,200)+3*cos(0.2*pi*n).*stepseq(0,0,200)+4*sin(0.6*pi*n).*stepseq(0,0,200);
>>y=filter(b,a,x);
>>subplot(2,1,2);
>>stem(n,y);
>>xlabel('n');
>>ylabel('y');
>>title('响应y(n)');
P3.3⑴
>>w=[0:
1:
500]*pi/500;
>>X=0.25*exp(j*3*w)./(exp(j*w)-1*ones(1,501));
>>magX=abs(X);
>>angX=angle(X);
>>subplot(2,1,1);
>>plot(w/pi,magX);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('|X|');
>>title('MagnitudePart');
>>subplot(2,1,2);
>>plot(w/pi,angX);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('radians');
>>title('AnglePart')
P3.3⑶
>>w=[0:
1:
500]*pi/500;
>>X=-3*exp(j*4*w)./(0.9^3*(exp(j*w)-0.9*ones(1,501)));
>>magX=abs(X);
>>angX=angle(X);
>>subplot(2,1,1);
>>plot(w/pi,magX);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('|X|');
>>title('MagnitudePart');
>>subplot(2,1,2);
>>plot(w/pi,angX);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('radians');
>>title('AnglePart')
P3.4窗函数
n=10;
window=boxcar(n);
subplot(4,1,1)
stem(abs(window));
ylabel('矩形窗');
title('幅度,M=10');
window=hanning(n);
subplot(4,1,2)
stem(abs(window));
ylabel('海宁窗');
window=triang(n);
subplot(4,1,3)
stem(abs(window));
ylabel('三角形窗');
window=hamming(n);
subplot(4,1,4)
stem(abs(window));
ylabel('哈明窗');
n=25;
window=boxcar(n);
subplot(4,1,1)
stem(abs(window));
ylabel('矩形窗');
title('幅度,M=25');
window=hanning(n);
subplot(4,1,2)
stem(abs(window));
ylabel('海宁窗');
window=triang(n);
subplot(4,1,3)
stem(abs(window));
ylabel('三角形窗');
window=hamming(n);
subplot(4,1,4)
stem(abs(window));
ylabel('哈明窗');
n=50;
window=boxcar(n);
subplot(4,1,1)
stem(abs(window));
ylabel('矩形窗');
title('幅度,M=50');
window=hanning(n);
subplot(4,1,2)
stem(abs(window));
ylabel('海宁窗');
window=triang(n);
subplot(4,1,3)
stem(abs(window));
ylabel('三角形窗');
window=hamming(n);
subplot(4,1,4)
stem(abs(window));
ylabel('哈明窗');
n=101;
window=boxcar(n);
subplot(4,1,1)
stem(abs(window));
ylabel('矩形窗');
title('幅度,M=101');
window=hanning(n);
subplot(4,1,2)
stem(abs(window));
ylabel('海宁窗');
window=triang(n);
subplot(4,1,3)
stem(abs(window));
ylabel('三角形窗');
window=hamming(n);
subplot(4,1,4)
stem(abs(window));
ylabel('哈明窗');
P3.17
⑴
>>w=[0:
1:
500]*pi/500;
>>H=(0.2+0.2*exp(-j*w)+0.2*exp(-2*j*w)+0.2*exp(-3*j*w)+0.2*exp(-4*j*w))./(1*ones(1,501));
>>magH=abs(H);
>>angH=angle(H);
>>subplot(2,1,1);
>>plot(w/pi,magH);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('|H|');
>>title('P3.17.1MagnitudePart');
>>subplot(2,1,2);
>>plot(w/pi,angH);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('radians');
>>title('AnglePart')
>>w=[0:
1:
500]*pi/500;
>>H=(1-exp(-j*w))./(1+1.95*exp(-j*w)+0.9025*exp(-2*j*w));
>>magH=abs(H);
>>angH=angle(H);
>>subplot(2,1,1);
>>plot(w/pi,magH);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('|H|');
>>title('P3.17.2MagnitudePart');
>>subplot(2,1,2);
>>plot(w/pi,angH);
>>grid
>>xlabel('frequencyinunitsofpi');
>>ylabel('radians');
>>title('AnglePart')
P4.3⑴
>>b=[0,0,2,1];a=[1,-1,0,0];
>>[delta,n]=impseq(0,0,7)
delta=10000000
n=01234567
>>x=filter(b,a,delta)
x=00233333
>>x=2*impseq(2,0,7)+3*stepseq(3,0,7)
x=00233333
>>zplane(b,a)
>>title('P4.31题')
⑵
>>b=[3,0.75*(4*sin(0.3*pi)-3*cos(0.3*pi))];
>>a=[1,-1.5*cos(0.3*pi),0.75*0.75];
>>[delta,n]=impseq(0,0,7)
delta=10000000
n=01234567
>>x=filter(b,a,delta)
x=3.00003.74961.6184-0.6822-1.5118-0.94920.01350.5458
>>x=3*(0.75).^n.*cos(0.3*pi*n).*stepseq(0,0,7)+4*(0.75).^n.*sin(0.3*pi*n).*stepseq(0,0,7)
x=3.00003.74961.6184-0.6822-1.5118-0.94920.01350.5458
>>zplane(b,a)
>>title('P4.32题')
P4.11
⑴>>a=[1,-11/4,13/8,-1/4];b=[1,-1,-4,4];[R,p,C]=residuez(b,a)
R=0.0000
-10.0000
27.0000
p=2.0000
0.5000
0.2500
C=-16