DSP数字信号处理习题集及matlab编程.doc
文本预览下载声明
P1.已知序列绘制。 for i=1:5
x(i)=0.8^(i-1);
end
h=[1 1 1 1 1];
y=conv(x,h)
m=[0 1 2 3 4 5 6 7 8];
stem(m,y,filled)
P2.已知复指数序列绘制0点该序列的实部和虚部。
所以
for n=1:20
Re(n)=1.2*exp(1.5*(n-1))*cos(2*(n-1));
Im(n)=1.2*exp(1.5*(n-1))*sin(2*(n-1));
end
for i=1:20
x(i)=i-1;
end
subplot(2,1,1)
stem(x,Re,filled);
lab1=\rightarrowRe(x[n]);text(14,1.2e+12,lab1,Fontsize,18);
subplot(2,1,2)
stem(x,Im,filled);lab2=\rightarrowIm(x[n]);text(14,4e+11,lab2,Fontsize,18);
P3.编写长度为5的中值滤波器程序。原始未受干扰的序列为:
s[n]=3[n(0.) ]n,加性噪声信号d[n]为随机序列,幅度0.,分别绘制长度为40的受干扰序列,以及中值滤波器的输出。for n=1:40
s(n)=3*(n-1)*0.5^(n-1);
end
a=(rand(1,40)-0.5)*4/5;
for i=1:40
x(i)=s(i)+a(1,i);
end
for i=1:40
b(i)=i-1;
end
subplot(2,2,1);
stem(b,s,r,filled);
subplot(2,2,2);
stem(b,a,g,filled);
subplot(2,2,3);
stem(b,x,b,filled);
y=zeros(1,40);
y(1)=x(1)/5;
y(2)=(x(1)+x(2))/5;
y(3)=(x(1)+x(2)+x(3))/5;
y(4)=(x(1)+x(2)+x(3)+x(4))/5;
for i=5:40
y(i)=1/5*(x(i)+x(i-1)+x(i-2)+x(i-3)+x(i-4));
end
subplot(2,2,4);
stem(b,y,r--,filled);
subplot(2,2,3);
stem(b,x,b,filled);
P4. 已知序列xn]={2.2,3,1.5,4.2,1.8}, x2[n]= {0.8,1,1.6,0.8},x[n]=x1[n]?x2[n] (卷积),分别绘制序列xn] ,x2[n]和x [n]的波形。x1=[2.2,3,1.5,4.2,1.8];
x2=[0.8,1,1.6,0.8];
y=conv(x1,x2);
for i=1:5
m(i)=i-1;
end
for i=1:4
n(i)=i-1;
end
for i=1:8
p(i)=i-1;
end
subplot(3,1,1);
stem(m,x1,filled);
subplot(3,1,2);
stem(n,x2,filled);
subplot(3,1,3);
stem(p,y,filled);
P5.编写4点滑动平均滤波器程序。原始未受干扰的序列为:
s[n]=3[n(0.8) ]n, 加性噪声信号d[n]为随机序列,幅度0.6,受干扰的序列为:x[n]= s[n]+ d[n],分别绘制长度为40的原始未受干扰的序列,噪声序列和受干扰序列,以及滑动平均滤波器的输出。for n=1:40
s(n)=3*(n-1)*0.8^(n-1);
end
a=(rand(1,40)-0.5)*6/5;
for i=1:40
x(i)=s(i)+a(1,i);
end
for i=1:40
b(i)=i-1;
end
subplot(2,2,1);
stem(b,s,r,filled);
subplot(2,2,2);
stem(b,a,g,filled);
subplot(2,2,3);
stem(b,x,b,filled);
y=zeros(1,40);
y(1)=x(1)/4;y(2)=(x(1)+x(2))/4;y(3)=(x(1)+x(2)+x(3))/4;
for i=4:40
y(i)=1/4*(x(i)+x(i-1)+x(i-2)+x(i-3));
end
subplot(2,2,4);
stem(b,y,r--,filled);
subplot(2,2,3);
stem(b,x,b,filled);
P6. clear
for i=1:8
x(i)=0.8^(i-1)*cos(0.75*pi*(i-1));
end
for j=1:8
y(j)=x(-j+9);
en
显示全部