70 Practical MATLAB® Applications for Engineers
Example 1.11
Given the discrete transfer function
Hz
zzz
zzz
()
....
...
08 045 035 001
1 0 85 0 43 0 58
123
(^123)
Create the script fi le disc_tranffunc that returns the following:
a. The discrete impulse and step response plots by creating an impulse and step
sequence as inputs
b. Repeat part a by using the discrete MATLAB functions dimpulse and dstep, and
compare the result obtained with the results of part a
MATLAB Solution
% Script file: disc tranf _ func
n = 30;
P = [0.8 -0.45 0.35 0.01];Q = [1 0.85 -0.43 -0.58];
I = [1 zeros(1, n-1)]; % impulse sequence
S = [ones(1, n)] ; % step sequence
FIGURE 1.59
Plots of f 1 (n), f 2 (n), f 3 (n), and f 4 (n) of Example 1.10.
f1(n) versus n f2(n) versus n
1
1
0.5
0.5
−0.5
− 1
0
0
0246
Amplitude [f1(n)] Amplitude [f2(n)]
Amplitude [f3(n)] Amplitude [f4(n)]
051015 20 25
n
f3(n) versus n f4(n) versus n
5
0
− 5
(^0102030)
n
n
10
8
6
4
2
0
− 1 0 1 2 3
n