数字信号处理实验全部程序MATLABWord格式.doc

上传人:b****2 文档编号:14624551 上传时间:2022-10-23 格式:DOC 页数:16 大小:302.50KB
下载 相关 举报
数字信号处理实验全部程序MATLABWord格式.doc_第1页
第1页 / 共16页
数字信号处理实验全部程序MATLABWord格式.doc_第2页
第2页 / 共16页
数字信号处理实验全部程序MATLABWord格式.doc_第3页
第3页 / 共16页
数字信号处理实验全部程序MATLABWord格式.doc_第4页
第4页 / 共16页
数字信号处理实验全部程序MATLABWord格式.doc_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

数字信号处理实验全部程序MATLABWord格式.doc

《数字信号处理实验全部程序MATLABWord格式.doc》由会员分享,可在线阅读,更多相关《数字信号处理实验全部程序MATLABWord格式.doc(16页珍藏版)》请在冰豆网上搜索。

数字信号处理实验全部程序MATLABWord格式.doc

subplot(4,2,1);

stem(n,A,'

fill'

);

xlabel('

时间序列n'

ylabel('

A'

subplot(4,2,2);

stem(n,B,'

时间序列n'

B'

subplot(4,2,3);

stem(n,C,'

A+B'

subplot(4,2,4);

stem(n,D,'

A-B'

subplot(4,2,5);

stem(n,E,'

A.*B'

subplot(4,2,6);

stem(n,F,'

A./B'

subplot(4,2,7);

stem(n,G,'

A.^B'

运行结果:

(2)用MATLAB实现以下序列。

a)x(n)=0.8n0≤n≤15

n=0:

15;

x=0.8.^n;

stem(n,x,'

xlabel('

x(n)=0.8^n'

b)x(n)=e(0.2+3j)n0≤n≤15

x=exp((0.2+3*j)*n);

x(n)=exp((0.2+3*j)*n)'

a)的时间序列 b)的时间序列

c)x(n)=3cos(0.125πn+0.2π)+2sin(0.25πn+0.1π)0≤n≤15

1:

x=3*cos(0.125*pi*n+0.2*pi)+2*sin(0.25*pi*n+0.1*pi);

xlabel('

x(n)=3*cos(0.125*pi*n+0.2*pi)+2*sin(0.25*pi*n+0.1*pi)'

d)将c)中的x(n)扩展为以16为周期的函数x16(n)=x(n+16),绘出四个周期

63;

x=3*cos(0.125*pi*rem(n,16)+0.2*pi)+2*sin(0.25*pi*rem(n,16)+0.1*pi);

x16(n)'

e)将c)中的x(n)扩展为以10为周期的函数x10(n)=x(n+10),绘出四个周期

39;

x=3*cos(0.125*pi*rem(n,10)+0.2*pi)+2*sin(0.25*pi*rem(n,10)+0.1*pi);

x10(n)'

d)的时间序列 e)的时间序列

(3)x(n)=[1,-1,3,5],产生并绘出下列序列的样本。

a)x1(n)=2x(n+2)-x(n-1)-2x(n)

3;

x=[1-135];

x1=circshift(x,[0-2]);

x2=circshift(x,[01]);

x3=2*x1-x2-2*x;

stem(x3,'

x1(n)=2x(n+2)-x(n-1)-2x(n)'

b)

x1=circshift(x,[01]);

x2=circshift(x,[02]);

x3=circshift(x,[03]);

x4=circshift(x,[04]);

x5=circshift(x,[05]);

xn=1*x1+2*x2+3*x3+4*x4+5*x5;

stem(xn,'

x2(n)=x(n-1)+2x(n-2)+3x(n-3)+4x(n-4)+5x(n-5)'

a)的时间序列 b)的时间序列

(4)绘出时间函数的图形,对x轴、y轴图形上方均须加上适当的标注。

a)x(t)=sin(2πt)0≤t≤10sb)x(t)=cos(100πt)sin(πt)0≤t≤4s

clc;

t1=0:

0.001:

10;

t2=0:

0.01:

xa=sin(2*pi*t1);

xb=cos(100*pi*t2).*sin(pi*t2);

subplot(2,1,1);

plot(t1,xa);

t'

x(t)'

title('

x(t)=sin(2*pi*t)'

subplot(2,1,2);

plot(t2,xb);

x(t)=cos(100*pi*t2).*sin(pi*t2)'

(5)编写函数stepshift(n0,n1,n2)实现u(n-n0),n1<

n0<

n2,绘出该函数的图形,起点为n1,终点为n2。

n1=input('

请输入起点:

'

n2=input('

请输入终点'

n0=input('

请输入阶跃位置'

n=n1:

n2;

x=[n-n0>

=0];

xlable('

ylable('

u(n-n0)'

2

请输入终点:

8

请输入阶跃位置:

6

(5)运行结果 (6)运行结果

(6)给一定因果系统求出并绘制H(z)的幅频响应与相频响应。

a=[1-0.670.9];

b=[1sqrt

(2)1];

[hw]=freqz(b,a);

fp=20*log(abs(h));

plot(w,fp);

xlabel('

时间序列t'

幅频特性'

xp=angle(h);

plot(w,xp);

相频特性'

(右上图)

常用典型序列

单位采样序列

function[x,n]=impseq(n1,n2,n0)

n=[n1:

n2];

x=[(n-n0)==0];

[x,n]=impseq(-2,8,2);

stem(n,x);

电信1201'

n0=-2;

n=[-10:

10];

nc=length(n);

x=zeros(1,nc);

fori=1:

nc

ifn(i)==n0

x(i)=1

end

end

stem(n,x);

电信1201采样序列第二种方法'

单位阶跃序列

function[x,n]=stepseq(n1,n2,n0)

x=[(n-n0)>

[x,n]=stepseq(-2,8,2);

实数指数

n=[0:

x=0.9.^n;

复数指数序列

alpha=-0.1+0.3*j;

x=exp(alpha*n);

real_x=real(x);

image_x=imag(x);

mag_x=abs(x);

phase_x=angle(x);

subplot(2,2,1);

stem(n,real_x);

subplot(2,2,2);

stem(n,image_x);

subplot(2,2,3);

stem(n,mag_x);

subplot(2,2,4);

stem(n,phase_x);

正余弦

x=3*cos(0.1*pi*n+pi/3);

例:

求出下列波形

x1(n)=2x(n-5)-3x(n+4)

function[y,n]=sigadd(x1,n1,x2,n2)

n=min(min(n1),min(n2)):

max(max(n1),max(n2));

y1=zeros(1,length(n));

y2=y1;

y1(find((n>

=min(n1))&

(n<

=max(n1))==1))=x1;

y2(find((n>

=min(n2))&

=max(n2))==1))=x2;

y=y1+y2;

function[y,n]=sigshift(x,m,n0)

n=m+n0;

y=x;

n=[-2:

x=[1:

7,6:

-1:

1];

[x11,n11]=sigshift(x,n,5);

[x12,n12]=sigshift(x,n,-4);

[x1,n1]=sigadd(2*x11,n11,-3*x12,n12);

stem(n1,x1);

已知某一系统方程为:

y[n]-y[n-1]+0.9y[n-2]=x[n]计算并画出脉冲响应h(n),n=(-20,100)

n=(-20:

100);

num=

(1);

den=[1-10.9];

x=impseq(-20,100,0);

h=filter(num,den,x);

stem(n,h)

时间序号N'

脉冲响应h'

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

当前位置:首页 > 高中教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1