华南理工大学信号与系统实验报告.docx
《华南理工大学信号与系统实验报告.docx》由会员分享,可在线阅读,更多相关《华南理工大学信号与系统实验报告.docx(33页珍藏版)》请在冰点文库上搜索。
华南理工大学信号与系统实验报告
ExperimentExport
Name:
StudentNo:
Institute:
Dec26,2011
ExperimentPurposes
1.BefamiliarwiththesoftwareEnvironmentandProgrammingflowinMATLAB5.3.
2.Learnhowtodrawthesignalwaveformanddeterminethesignalproperties.
3.Calculatetheconvolution,frequencyresponseandsystemoutputbyusingthefunctions:
conv,freqz,freqsandfilter.
ExperimentContents
实验项目一:
MATLAB编程基础及典型实例
①画出离散时间正弦信号并确定基波周期(注:
pi表示圆周率)
1x1[n]=sin(pi*4/4)*cos(pi*n/4)
2x2[n]=cos(pi*n/4)*cos(pi*n/4)
3x3[n]=sin(pi*n/4)*cos(pi*n/8)
programformatlab
n=0:
31;
x1=sin(pi*n/4).*cos(pi*n/4);
x2=cos(pi*n/4).*cos(pi*n/4);
x3=sin(pi*n/4).*cos(pi*n/8);
subplot(3,1,1);
stem(n,x1);
title('x1');
subplot(3,1,2);
stem(n,x2);
title('x2');subplot(3,1,3);
stem(n,x3);
title('x3');
gridon;
Conclusion:
Thesesignalsisperiodic,thefirstandsecondsignal'periodare4.Thethirdsignal'periodis16.
②离散时间系统性质:
离散时间系统往往是用几个性质来表征,如线性、时不变性、稳定性、因果性及可逆性等。
MATLAB可用来构成一些反例证明某些性质不满足。
⑻系统y[n]=sin((pi/2)x[n])不是线性的。
利用信号x1[n]二5[和x2=2S[n来证明该
系统不满足线性性质。
(b)系统y[n]=x[n]+x[n+1]不是因果的。
利用信号x[n]=u[n]证明它。
定义向量x和y分别代表在-5<=n<=9上的输入和在-6<=n<=9上的输出。
Programformatlab
1.4(a)
n二[0:
20];
x1=[1zeros(1,20)];
x2=2*x1;
x=x1+x2;
y1=sin((pi/2)*x1);
y2=sin((pi/2)*x2);
y=sin((pi/2)*x);
figure
(1),stem(n,y1)
figure
(2),stem(n,y2)
figure(3),stem(n,y)
1.4(b)
x1二[zeros(1,5)ones(1,10)];
x2=[zeros(1,4)ones(1,11)];
y=x1+x2;
n仁[-5:
9];
n2=[-5:
9];
figure
(1),stem(n1,x1)
figure
(2),stem(n2,y)
Conclusion:
y[n]=sin((pi/2)x[n])isnotlinearandy[n]=x[n]+x[n+1]isnotcuasalandtheresultisshowninthechartabove.
ri,0<^1<5,
X0③卷积计算:
有限长信^(n)=otherwise・和h(n)=
0*otherwise.
(1)用解析方法计算y[n]=x[n]*h[n]
⑵用conv计算y。
步骤:
a.定义OwnW区间上的向量x
b.定义OwnW区间上的向量h
c.用y=conv(x,h)计算y
d.构造y的标号向量ny
e.用stem(ny,y)画出结果
f.验证此结果与解析导出的结果是否一致?
Programformatlab
N=6;
M=6;
L=N+M-1;
x=[1,1,1,1,1,1];
h=[0,1,2,3,4,5];
y=conv(x,h);
nx=0:
N-1;
nh=0:
M-1;
ny=0:
L-1;
stem(ny,y);
xlabel('n');
xlabel('y');
Conclusion:
y=ans=3andtheresultisshowinthepictureabove.
实验项目2
、实验项目名称:
周期信号傅里叶分析及其MATLAB实现
二、上机实验题目:
特征函数在LTI系统傅里叶分析中的应用1.实验项目的目的和任务:
掌握特征函数在系统响应分析中的作用,正确理解滤波的概念。
上机实验容:
函数Filter、Freqz和Freqs的使用:
2.2节(g)、3.2节、4.1节
计算离散时间傅里叶级数:
3.1节
LTI系统的特征函数:
3.4节(a),(b),(c)
用离散时间傅里叶级数综合信号:
3.5节(d),(e),(f),(h).
吉布斯现象:
根据英文教材Example3.5验证Fig3.9的吉布斯现象(a)~(d).
函数Filter、Freqz和Freqs的使用:
2.2节(g)、3.2节、4.1节
KM
filter:
计算由线性常系数差分方程
£a(k+l)y(n■k)=£h(m+l)x(n-m)圮=ofn=o
征的因果LTI系统的输出若x是在nx含系数ak和bm,那么y=filter(b,a,x)就得到在nxy[n]+2y[n-1]=x[n]-3x[n-1]则a=[12],b=[1-3]
%2.2g
MainProgram
x=[1,1,1,1,1,1,0,0,0,0,0];
h=[0,1,2,3,4,5];
y=filter(h,1,x);
ny=[0:
10];
stem(ny,y);
xlabel('n');
xlabel('y');
%3.2
a仁[1-0.80];b1=[20-1];N=4;
[h2omega2]=freqz(b1,a1,N,'whole')
%4.1
a=[13];b=3;figure;freqs(b,a);w=linspace(0,3*pi);
h=freqs(b,a,w);figure;plot(w,abs(h));
a1=[341];
b1=[105];
figure;freqs(b1,a1);
Oe£/ah衣*的*>慄洛*
□.Jn\X3*■A■3DE■□
胪:
「[丨“I21丨i:
门bi7:
丨「Mil
itf310''1G5iQi
Frsquenri1(rsrifEj
②计算离散时间傅里叶级数:
3.1节
x=[11zeros(1,30)];
a=(132)*fft(x)n二[0:
31];
figure
(1),stem(n,a)figure
(2),stem(n,imag(a))y=32*ifft(a);
figure(3),stem(n,y)
③LTI系统的特征函数:
3.4节(a),(b),(c)
%3.4(a)
n=-20:
100;
x1=exp(j*(pi/4)*n);
x2=sin(pi*n/8+pi/16);
x3=(9/10)八n;
x4=n+1;
subplot(5,1,1),stem(n,real(x1));title('real(x1)');axis([0,100,-5,5])
subplot(5,1,3),stem(n,x2);title('x2');axis([0,100,-5,5])subplot(5,1,4),stem(n,x3);title('x3')subplot(5,1,5),stem(n,x4);title('x4')
%3.4(b)
n=0:
100;
x1=exp(j*(pi/4)*n);
x2=sin(pi*n/8+pi/16);
x3=(9/10)八n;
x4=n+1;
a二[1-0.25];
b=[10.9];
y1=filter(b,a,x1);y2=filter(b,a,x2);
y3二filter(b,a,x3);y4二filter(b,a,x4);figure;
subplot(5,1,1),stem(n,real(y1));title('real(y1)')
subplot(5,1,3),stem(n,y2);title('y2')subplot(5,1,4),stem(n,y3);title('y3')subplot(5,1,5),stem(n,y4);title('y4')
%3.4(c)h1=y1./x1;h2=y2./x2;h3=y3./x3;h4=y4./x4;figure;
subplot(5,1,1),stem(n,real(h1));title('real(h1)')subplot(5,1,2),stem(n,imag(h1));title('imag(h1)')subplot(5,1,3),stem(n,h2);title('h2')subplot(5,1,4),stem(n,h3);title('h3')subplot(5,1,5),stem(n,h4);title('h4')
%3.5(d)functionx=period(xn)x=zeros(1,64);[a,b]=size(xn);
fork=1:
(64/b)
x(1,b*(k-1)+1:
b*k)=xn;end
x1=ones(1,8);x2=[x1,zeros(1,8)]x3=[x1,zeros(1,24)];
x11=period(x1);
x22=period(x2);
x33=period(x3);
n二[0:
63];
subplot(3,1,1);
stem(n,x11)subplot(3,1,2);
stem(n,x22)subplot(3,1,3);
stem(n,x33)
仙tfwIftTIm*翌**H0p
1UM鸟fifoB■EH
x2=
Columns1through131111111100000
Columns14through16
000
%3.5(e)
x11=[ones(1,8)ones(1,8)ones(1,8)ones(1,8)ones(1,8)ones(1,8)ones(1,8)ones(1,8)];x22=[ones(1,8)zeros(1,8)ones(1,8)zeros(1,8)ones(1,8)zeros(1,8)ones(1,8)zeros(1,8)];x33=[ones(1,8)zeros(1,24)ones(1,8)zeros(1,24)];
a1=(164)*fft(x11);
a2=(164)*fft(x22);
a3=(164)*fft(x33);
n二[0:
63];
subplot(3,1,1);
figure
(1),stem(n,a1)subplot(3,1,2);
figure
(2),stem(n,a2)
subplot(3,1,3);
figure(3),stem(n,a3)
figure(4),stem(n,imag(a1))
figure(5),stem(n,imag(a2))
figure(6),stem(n,imag(a3》
x3_2(k)二real(func(a3,k));
end
stem(n,x3_2)
%3.5(h)functionx=dtfs(ak,n)
x=0;
fork=-31:
31
ifk<=0
ak(k)=ak(-k)x=x+ak(k)*exp(i*k*(2*pi/32)*n);
else
x=x+ak(k)*exp(i*k*(2*pi/32)*n);
endend
figure;plot(x1,y1,t,x);title('N=49')end
end
L
实验项目3:
一、实验项目名称:
非周期信号傅里叶分析的MATLAB实现
二、上机实验题目:
傅里叶变换的基本性质及其在系统分析中的应用
1.实验项目的目的和任务:
熟练掌握连续时间傅里叶变换的基本性质及其在系统分析中应用。
2.上机实验容:
1连续时间傅里叶变换性质:
4.3节(b)
2求由微分方程描述的单位冲激响应:
4.5节(b)
3计算离散时间傅里叶变换:
5.1节(a),(b),(c)
4由欠采样引起的混叠:
7.1节(a),(b),(c),(d)
3.学时数:
2
1连续时间傅里叶变换性质:
4.3节(b)
loadsplat
y=y((1:
8192));
N=8192;
fs=8192;
Yfftshift(fft(y));
Y1=conj(Y);
Y1=fft(Y1);
Y1=real(Y1);
sound(Y1,fs)
2求由微分方程描述的单位冲激响应:
4.5b
b1=[01-2];
a1=[11.50.5];
[r1,p1]=residue(b1,a1)
Result:
r1=
6
-5
p1=
-1.0000
-0.5000
3计算离散时间傅里叶变换:
5.1节⑻,(b),(c)
4由欠采样引起的混叠:
7.1节(a),(b),(c),(d)
%7.1(a)(b):
T=1/8192;n=[1:
50];
omig=2*pi*1000;
n=[0:
8192];x=sin(omig*T.*n);n2=[0:
50].*T;
figure;
subplot(2,1,1);stem(n2,x(1:
51));
subplot(2,1,2);plot(n2,sin(omig.*n2));
%7.1(c)
T=18192;n二[1:
50];
omig=2*pi*1000;
n=[0:
8192];x=sin(omig*T.*n);n2=[0:
50].*T;figure;
subplot(2,1,1);stem(n2,x(1:
51));
subplot(2,1,2);plot(n2,sin(omig.*n2));
%7.1(d)
ws=2*pi*8192;w0=2*pi*1500;T=18192;
n二[0:
8191];
t=n*T;
x=sin(w0*t);
subplot(2,1,1);
stem(n(1:
50),x(1:
50));
xlabel('n');
ylabel('x[n]');
subplot(2,1,2);
plot(n(1:
50),x(1:
50));
xlabel('n');
ylabel('x(t)');
gridon;
figure;
N=length(x);
X二fftshift(fft(x,N))*(2*pi/N);%CTFTS;
w=linspace(-1,1-1N,N)/(2*T);plot(w,abs(X));
xlabel('w');ylabel('abs(X)');
■L4r奸hwnirn加艸*
实验项目4:
一、实验项目名称:
LTI系统复频域分析的MATLAB实现
二、上机实验题目:
拉氏变换与Z变换的基本性质在系统分析中的应用
1.实验项目的目的和任务:
掌握拉氏变换、Z变换的基本性质及其在系统分析中的典型应用
2.上机实验容:
1作系统的零极点图(用roots和zplane函数):
9.1节(a),(c)
2求系统频率响应和极点位置:
9.2节⑻,(b)
3离散时间频率响应的几何解释:
10.2节(a),(b),(c),(d),(e)
3.①作系统的零极点图(用roots和zplane函数):
9.1节(a)
(i)
a1=[15];
b1=[123];
zs二roots(al)
ps二roots(bl)
plot(real(zs),imag(zs),'o');
holdon
plot(real(ps),imag(ps),'x');
grid
axis([-52-22]);
E曲込*I&dfeQviiaap松虽mtfap
、口a□■□
(ii)
a2=[2512];
b2=[1210];
zs二roots(a2)
ps二roots(b2)
plot(real(zs),imag(zs),'o');holdon
plot(real(ps),imag(ps),'x');
grid
axis([-33-33]);
(iii)
a3=[2512];
b3=[141420];
zs=roots(a3)
ps=roots(b3)
plot(real(zs),imag(zs),'o');
holdon
plot(real(ps),imag(ps),'x');
grid
axis([-33-33]);
fit[du僭*鰹柿TwhBunHh*
%9.1(c)
a=[01-3];b=[125];
zs二roots(b)
ps二roots(a)
plot(real(zs),imag(zs),'o');holdon
plot(real(ps),imag(ps),'x');
gridon
axis([-55-55]);
zplane(a,b);
Result:
zs=
-1.0000+2.0000i
-1.0000-2.0000i
ps=
3
15屛』百fltTS?
tf,J梟
RealPart
②求系统频率响应和极点位置
%9.2a
w=1;
a1=[101];
a2=[10.51];
a3=[121];
a4=[141];
ps1二roots(a1)
ps2二roots(a2)
ps3二roots(a3)
ps4二roots(a4)
subplot(2,2,1);
plot(real(ps1),imag(ps1),'x');
axis([-44-44]);
xlabel('Re');
ylabel('lm');
title('polepointfigure(a1)');
grid;
subplot(2,2,2);
plot(real(ps2),imag(ps2),'x');
axis([-44-44]);
xlabel('Re');
ylabel('Im');
title('polepointfigure(a2)');
grid;
subplot(2,2,3);
plot(real(ps3),imag(ps3),'x');
axis([-44-44]);
xlabel('Re');
ylabel('Im');
title('polepointfigure(a3)');
grid;
subplot(2,2,4);
plot(real(ps4),imag(ps4),'x');
axis([-44-44]);
xlabel('Re');
ylabel('lm');
title('polepointfigure(a1)');
grid
Result:
ps1=
0+1.0000i
0-1.0000i
ps2=
-0.2500+0.9682i
-0.2500-0.9682i
ps3=
-1
-1
ps4=
-3.7321
-0.2679
%9.2bn=-5:
0.1:
5;
b=[1];
a1=[101];
a2=[10.51];
a3=[121];
a4=[141];
freqs(a1,b,n)
figure
freqs(a2,b,n)
figure
freqs(a3,b,n)
figure
freqs(a4,b,n)
«*£誓
0
(FntfamcyIrada
③离散时间频率响应的几何解释
%10.2a
b=[100];
a=[1-0.90.81];
zsl二roots(b)
ps二roots(a)
plot(real(zs),imag(zs1),'o');
holdon;
plot(real(ps1),imag(ps1),'x');
grid;
axis([-44-44]);
xlabel('Re');
ylabel('lm');
title('zero-polepointfigure');
Result:
zs1=
0
0
ps=
0.4500+0.7794i
0.4500-0.7794i
%10.2bcde
a仁[1-0.90.81];b1=[100];
zs1=roots(b1);ps1=roots(a1);
omega二[0:
511]*pi/256;
unitcirc二exp(j*omega);
polevectors1=ones(2,1)*unitcirc-ps1*ones(1,512);
polelength1二abs(polevectors1);
poleangle1二atan2(imag(polevectors1),real(polevectors1));zerovectors仁ones(2,1)*unitcirc-zs1*ones(1,512);
zerolengthl二abs(zerovectorsl);
zeroangle仁atan2(imag(zerovectors1),real(zerovectors1));
figure
plot(omega,polelength1);
holdon
plot(omega,zerolength1,'r');
title('polelengthandzerolength1')
geomH1mag=prod(zerole