第1题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
clear all;
clc;
syms z;
num = [1,-1,0];
den = [1,0.75,0.125];
H = tf(num,den)
H = (z^2-z)/(z^2+0.75*z+0.125);
hn = iztrans(H)

[h1,t]=impz(num,den);
[s1,t]=stepz(num,den);
subplot(2,1,1);
stem(t,h1);
title('Impulse Response');
xlabel('n');

subplot(2,1,2);
stem(t,s1);
title('Step Response');
xlabel('n');

输出:

冲激响应:

H = (s^2 - s )/(s^2 + 0.75 s + 0.125)

hn = 6_(-1/2)^n - 5_(-1/4)^n

冲激响应和阶跃响应序列:

image-20211224100744763

第2题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
clear all;
clc;
syms z;
num = 0.25*[0,1,1,1,1];
den = [1];
H = tf(num,den)
H = 0.25*z^3 + 0.25*z^2 + 0.25*z + 0.25;
hn = iztrans(H);
hn = simplify(hn)

[h1,t]=impz(num,den);
[s1,t]=stepz(num,den);
subplot(2,1,1);
stem(t,h1);
title('Impulse Response');
xlabel('n');

subplot(2,1,2);
stem(t,s1);
title('Step Response');
xlabel('n');

输出:

冲激响应:

H = 0.25 s^3 + 0.25 s^2 + 0.25 s + 0.25

hn = kroneckerDelta(n, 0)/4 + iztrans(z^2, z, n)/4 + iztrans(z^3, z, n)/4 + iztrans(z, z, n)/4

冲激响应与阶跃响应序列:

image-20211224100927265