1.510.50-0.5-1-1.5-202468101214161820(3)用impz函数 a1=[1,0.75,0.125]; b1=[1,-1];
impz(b1,a1,21);
Impulse Response1.510.5ed0utilpmA -0.5-1-1.5-202468101214161820n (samples)b. 单位阶跃响应: (1)用filter函数 a1=[1,0.75,0.125]; b1=[1,-1]; n=0:20;
x2=ones(1,21);
y1filter=filter(b1,a1,x2); stem(n,y1filter); title('y1filter_step'); xlabel('x'); ylabel('y');
21
(2)用conv函数 a1=[1,0.75,0.125]; b1=[1,-1]; x2=ones(1,21);
[h]=impz(b1,a1,20); y1=conv(h,x2);
y1conv=y1(1:21); %为何y1conv要取y1中1:21的值,解释见n1=0:20; %y2?单位阶跃响应?用conv函数中注释 stem(n1,y1conv,'filled'); title('y1conv'); xlabel('n'); ylabel('y1[n]');
y1conv10.80.60.4]0.2n[1y0-0.2-0.4-0.6-0.802468101214161820n
22
(3)用impz函数 a=[1,0.75,0.125]; b=1;
impz(b,a)
Impulse Response10.80.60.4edu0.2tilpmA0 -0.2-0.4-0.6-0.80510152025303540n (samples)
II. y[n]=0.25(x[n-1]+x[n-2]+x[n-3]+x[n-4]) a. 单位冲激响应: (1)用filter函数 a2=1;
b2=[0 0.25*ones(1,4)]; n=0:9;
x1=[1 zeros(1,9)];
y2filter=filter(b2,a2,x1); stem(n,y2filter); title('y2filter'); xlabel('x'); ylabel('y')
y2filter0.250.20.15y0.10.0500123456789x
23
(2)用conv函数 a2=1;
b2=[0 0.25*ones(1,4)]; x1=[1 zeros(1,5)]; [h]=impz(b2,a2,5); y2conv=conv(h,x1); n=0:9;
stem(n,y2conv,'filled')
0.250.20.150.10.0500123456789(3)用impz函数 a2=1;
b2=[0 0.25*ones(1,4)]; impz(b2,a2,10);
Impulse Response0.250.2e0.15dutilpmA 0.10.0500123456789n (samples)b. 单位阶跃响应: (1)用filter函数 a2=1;
b2=[0 0.25*ones(1,4)]; n=0:20;
x2=ones(1,21);
24
相关推荐: