28
Practical MATLAB
® Applications for Engineers
R.1.95 A unit step sequence of length N can be generated using the following MATLAB
command:
un = [ones(1, N)]
R.1.96 The shifted (or delayed) unit step sequence u(n − k) can be created by executing the
following MATLAB command:
unk = [zeros(1, k − 1) ones(1, N)]
Observe that the total number of elements of the sequence unk is N + k − 1.
R.1.97 The MATLAB function stepfun(n, no) returns the shifted step (by no units to the
right) sequence shown in Figure 1.26. Recall that the stepfun(n, no) can be used with
either analog or discrete arguments, defi ned as
stepfun n no
u n no
n no
n no
( , )
(
)
ϭ
ϭ
Ϫ
Ն
Ͻ
1
0
for
for



1.5
1
0.5
−0.5
−10 −8
−6
−4
−2
2
4
6
0
0
Amplitude
8
10
time index n
δ(n − 3) versus n
FIGURE 1.25
Plot of x(n) = δ(n − 3) of R.1.94.
n0
n0+ N
…
stepfun(n, n0)
n
FIGURE 1.26
Plot of stepfun(n, no) of R.1.97.
CRC_47760_CH001.indd 28
CRC_47760_CH001.indd 28
7/25/2008 4:16:15 PM
7/25/2008 4:16:15 PM
Précédent

- 39/708

Suivant