信号实验报告一.docx
- 文档编号:28761047
- 上传时间:2023-07-19
- 格式:DOCX
- 页数:16
- 大小:16.60KB
信号实验报告一.docx
《信号实验报告一.docx》由会员分享,可在线阅读,更多相关《信号实验报告一.docx(16页珍藏版)》请在冰豆网上搜索。
信号实验报告一
1.1n=1:
1:
50;
x=cos(0.02*pi*n);
y=cos(0.02*pi*n)+0.5*randn(1,50);
subplot(2,2,1)
stem(n,x)
subplot(2,2,2)
stem(n,y)
1.2clearall
clc
n1=1:
1:
5;
x1=2*n1-1;
n2=2:
1:
6;
x2=2*n2-2;
[y1,n3]=sigadd(x1,n1,x2,n2);
[y2,n4]=sigmult(x1,n1,x2,n2);
n0=2;
[y3,n5]=sigshift(x1,n1,n0);
[y4,n6]=sigfold(x2,n2);
subplot(2,2,1)
stem(n3,y1)
subplot(2,2,2)
stem(n4,y2)
subplot(2,2,3)
stem(n5,y3)
subplot(2,2,4)
stem(n6,y4)
3.3
function[X,w]=ft1(x,n,k)
w=(pi/abs(max(k)/2))*k;
X=x*(exp(-j*pi/abs(max(k)/2))).^(n'*k);
function[y,ny]=ft2(x,nx,z,nz)%定义通用卷积函数ft2
nys=nx
(1)+nz
(1);
nyf=nx(end)+nz(end);
y=conv(x,z);
ny=nys:
nyf;
clearall
clc
nx=-10:
10;
x=(-0.9*exp(1i*pi*4/3)).^nx;
k=-200:
200;
[X,w]=ft1(x,nx,k);
subplot(3,1,1)
plot(w/pi,X)
grid
xlabel('frequencyinpiunits')
ylabel('/X/')
title('X(e(j*w)')
ny1=nx;
w0=pi;
y1=x.*exp(j*w0*ny1);
[Y1,w]=ft1(y1,ny1,k);
subplot(3,1,2)
plot(w/pi,Y1)
grid
xlabel('frequencyinpiunits')
ylabel('/Y1/')
title('X(e(j*(w-w0)')
[y,ny]=ft2(x,nx,y1,ny1);
[Y,w]=ft1(y,ny,k);
subplot(3,1,3)
plot(w/pi,Y)
grid
xlabel('frequencyinpiunits')
ylabel('/Y/')
title('时域卷积后的频域特性')
5.2
clearall
clc
a=[1,-0.8,-0.12];
b=[0.1,0.3];
subplot(2,2,1);%绘制单位取样响应图
impz(b,a);
subplot(2,2,2);%绘制零极点图
zplane(b,a);
[H,w]=freqz(b,a);%计算频率响应
subplot(2,2,3);
plot(w/pi,abs(H));
grid
xlabel('frequencyinpiunits')
title('幅频响应')
ylabel('Magnitude')
subplot(2,2,4)
plot(w/pi,angle(H));
grid
xlabel('frequencyinpiunits')
title('相频响应')
ylabel('Radians')
6
6.1
6.2
clearall
clc
fs0=[10,50,100];
forr=1:
3
fs=fs0(r);
f=20;
n=(0:
1/fs:
1)';
x=cos(2*pi*f*n+pi/2);
t=linspace(-0.5,1.5,500)';
ya=sinc(fs*t(:
ones(size(n)))-fs*n(:
ones(size(t)))')*x;
subplot(3,1,r);
plot(n,x,'o',t,ya);
grid;
xlabel('ms');
ylabel('mag');
switchfs0(r)
case'1',
title('fs=10HZ')
case'2',
title('fs=50HZ')
case'3',
title('fs=100HZ')
otherwise
end
axis([-0.5,1.5,-2,2]);
End
6.3
function[f,k]=lsjuanji(f1,f2,k1,k2)
%Thefunctionofcomputef=f1*f2
%f:
卷积和序列f(k)对应的值
%k:
序列f(k)对应的序列号
%f1:
序列f1(k)
%f2:
序列f2(k)
%k1:
序列f1(k)对应的序列号
%k2:
序列f2(k)对应的序列号
f=conv(f1,f2)
k0=k1
(1)+k2
(1);%序列f(k)对应的起始序列号
k3=length(f1)+length(f2)-2;%序列f(k)的宽度
k=k0:
k0+k3;%序列f(k)对应的序列号向量
subplot(2,2,1)
stem(k1,f1)
title('f1(k)')
xlabel('k')
ylabel('f1(k)')
subplot(2,2,2)
stem(k2,f2)
title('f2(k)')
xlabel('k')
ylabel('f2(k)')
subplot(2,2,3)
stem(k,f)
title('f(k)')
xlabel('k')
ylabel('f(k)')
clearall
clc
a=[1,1.49,0.085,1.1709,0.75735];
b=[0.5,2.5,-25];
subplot(3,3,1);%绘制零极点图
zplane(b,a);
grid
title('零极点图 ')
h(n)=impz(b,a);
subplot(3,3,2);%绘制单位取样响应图
impz(b,a);
grid
title('单位取样响应图 ')
[H,w]=freqz(b,a);%计算频率响应
subplot(3,3,7);
plot(w/pi,abs(H));
grid
xlabel('frequencyinpiunits')
title('幅频响应')
ylabel('Magnitude')
subplot(3,3,8)
plot(w/pi,angle(H));
grid
xlabel('frequencyinpiunits')
title('相频响应')
ylabel('Radians')
%求零输入响应
i=0:
3;
Y(i)=[1 211]; %y的初始状态
X(i)=[0 000]; %x 的初始状态
x1=zeros(1,20);
zi1=filtic(b,a,y(i),x(i)); %为filter函数准备初始值
yi=filter(b,a,x1,zi1); %求零输入响应
subplot(3,3,3);
stem(n,yi,'r.');
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('yi(k)')
title('零输入响应 ')
%差分方程求零状态响应
xn=[1zeros(1,20)]
ys1=filter(b,a,xn)
subplot(3,3,4)
n1=0:
length(ys1)-1
stem(n1,ys1,'.')
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('y(k)')
title('差分方程求零状态响应 ')
%迭代求零状态响应
y(4)=1.49*y(3)-0.085*y
(2)-1.1709y
(1)+0.75735y(0)+0.5x
(2)+2.5x
(1)-25x(0);
fork=5:
20
y(k)=1.49*y(k-1)-0.085*y(k-2)-1.1709y(k-3)+0.75735y(k-4)+0.5xn(k-2)+2.5xn(k-3)-25xn(k-4);
y(k)
end
ys2=[y0y(1:
20)]%取y(k)从y(0)到y(20)
k=1:
21
subplot(3,3,5)
stem(k-1,ys2);
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('y(k)')
title('迭代求零状态响应 ')
%卷积法求零状态响应
k1=k2=0:
20;
[ys3,k]=lsjuanji(xn,h(n),k1,k2)
subplot(3,3,6)
stem(k,ys3,'.')
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('y(k)')
title('卷积法求零状态响应 ')
clearall
clc
a=[1,1.49,0.085,1.1709,0.75735];
b=[0.5,2.5,-25];
subplot(2,2,1);%绘制零极点图
zplane(b,a);
grid
title('零极点图?
')
hn=impz(b,a);
subplot(2,2,2);%绘制单位取样响应图
impz(b,a);
grid
title('单位取样响应图?
')
[H,w]=freqz(b,a);%计算频率响应
subplot(2,2,3);
plot(w/pi,abs(H));
grid
xlabel('frequencyinpiunits')
title('幅频响应')
ylabel('Magnitude')
subplot(2,2,4)
plot(w/pi,angle(H));
grid
xlabel('frequencyinpiunits')
title('相频响应')
ylabel('Radians')
clearall
clc
a=[1,1.49,0.085,1.1709,0.75735];
b=[0.5,2.5,-25];
%求零输入响应
n=0:
21;
yi=[1,2,1,1];%y的初始状态
xi=[0,0,0,0];%x的初始状态
x1=zeros(1,20);
zi1=filtic(b,a,yi,xi);%为filter函数准备初始值
yi=filter(b,a,x1,zi1);%求零输入响应
subplot(3,3,5);
stem(n,yi,'r.');
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('yi(k)')
title('零输入响应')
%差分方程求零状态响应
xn=[1zeros(1,20)];
ys1=filter(b,a,xn);
subplot(3,3,6)
n1=0:
length(ys1)-1;
stem(n1,ys1,'.')
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('y(k)')
title('差分方程求零状态响应')
%迭代求零状态响应
y(4)=1.49*y(3)-0.085*y
(2)-1.1709*y
(1)+0.75735*y(0)+0.5*x
(2)+2.5*x
(1)-25*x(0);
fork=5:
20
y(k)=1.49*y(k-1)-0.085*y(k-2)-1.1709*y(k-3)+0.75735*y(k-4)+0.5*xn(k-2)+2.5*xn(k-3)-25*xn(k-4);
y(k)
end
ys2=[y0y(1:
20)];%取y(k)从y(0)到y(20)
k=1:
21;
subplot(3,3,7)
stem(k-1,ys2);
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('y(k)')
title('迭代求零状态响应')
%卷积法求零状态响应
k1=0:
20;
k2=k1;
[ys3,k]=lsjuanji(xn,hn,k1,k2);
subplot(3,3,8)
stem(k,ys3,'.')
axis([0,21,-5,5])
grid
xlabel('k')
ylabel('y(k)')
title('卷积法求零状态响应?
')
思考题
1function[X,w]=ft1(x,n,k)
w=(pi/abs(max(k)/2))*k;
X=x*(exp(-j*pi/abs(max(k)/2))).^(n'*k);
clearall
clc
n=0:
1000;
x=(-0.5).^n;
k=-200:
200;
[X,w]=ft1(x,n,k);
magX=abs(X);
angX=angle(X);
realX=real(X);
imagX=imag(X);
subplot(3,2,1)
plot(w/pi,magX)
grid
xlabel('frequencyinpiunits')
title('幅频特性')
ylabel('Magnitude')
subplot(3,2,3)
plot(w/pi,angX)
grid
xlabel('frequencyinpiunits')
title('相频特性')
ylabel('Radians')
subplot(3,2,2)
plot(w/pi,realX)
grid
xlabel('frequencyinpiunits')
title('实部')
ylabel('Real')
subplot(3,2,4)
plot(w/pi,imagX)
grid
xlabel('frequencyinpiunits')
title('虚部')
subplot(3,2,5)
plot(w/pi,X)
grid
xlabel('frequencyinpiunits')
title('频谱图')
ylabel('X')
axis([-2.5,2.5,0,2.5])
2.
clearall
clc
a=[1,-1.6,0.9425];
b1=[1,-0.3];
b2=[1,0.8];
b3=[1,-0.8];
b4=[1,-1.6,0.8];
subplot(4,2,1);%绘制零极点图
zplane(b1,a);
grid
title('H1零极点图?
')
subplot(4,2,2);%绘制单位取样响应图
impz(b2,a);
grid
title('H1单位取样响应图?
')
axis([0,200,-5,5])
subplot(4,2,3);%绘制零极点图
zplane(b2,a);
grid
title('H2零极点图?
')
subplot(4,2,4);%绘制单位取样响应图
impz(b3,a);
grid
title('H2单位取样响应图?
')
axis([0,200,-5,5])
subplot(4,2,5);%绘制零极点图
zplane(b3,a);
grid
title('H3零极点图?
')
subplot(4,2,6);%绘制单位取样响应图
impz(b3,a);
grid
title('H3单位取样响应图?
')
axis([0,200,-5,5])
subplot(4,2,7);%绘制零极点图
zplane(b4,a);
grid
title('H4零极点图?
')
subplot(4,2,8);%绘制单位取样响应图
impz(b4,a);
grid
title('H4单位取样响应图?
')
axis([0,200,-5,5])
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 信号 实验 报告
![提示](https://static.bdocx.com/images/bang_tan.gif)