PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 27


and by

P


N


av fn
N

N



1 


21


2
()


∑ (discrete case)


R.1.87 Periodic signals are referred to as power signals, since they possess infi nite energy.
R.1.88 An infi nite energy signal with fi nite power is referred to as a power signal. A fi nite
energy signal with infi nite power is referred as an energy signal.
R.1.89 Recall that the MATLAB function stem returns the plot of a discrete sequence,
whereas the plot command returns the plot of an analog (continuous) signal.
R.1.90 Recall that if z is complex then the MATLAB command plot(z) returns the continu-
ous plot of imag(z) versus real(z), whereas the command stem(z) returns the discrete
plot of real(z) versus n.
R.1.91 The discrete unit impulse sequence δ(n) of length N can be obtained by using the
MATLAB statement
Imp = [1 zeros(1, N − 1)]

Imp consists of an N-element row vector with one as the fi rst element, followed
by N − 1 zeros, with the implicit assumption that the fi rst element corresponds to
n = 0 , of the sequence δ(n).
R.1.92 The shifted unit impulse δ(n − k) of length N can be created by using the following
MATLAB statement:

Impk = [zeros(1, k − 1) 1 zeros(1, N − k)]

R.1.93 Another way to generate a unit impulse sequence of length n = 2N + 1 with the
unit impulse located at k, where k may be anywhere over the range −N < n < N, is
by the following function fi le:
function [k,n] = Impfun(n1,n2,n3)
n = n2:1:n3;
k = [(n − n1)==0];
R.1.94 For example, the following script fi le sequence_impulse returns the discrete plot of
the signal x(n) = δ(n − 3), using a 21-element sequence over the range − 10 ≤ n ≤ 10 ,
and the function fi le Impfun:

MATLAB Solution
% Script file: sequence _ impulse
n = -10:1:10;
[k,n] = Impfun(3,-10,10);
stem(n,k)
title(‘ \delta(n - 3) vs. n’)
xlabel(‘time index n’)
ylabel(‘Amplitude’)
a = min(n);
b = max(n);
c = min(k)-.5;
d = max(k)+.5;
axis([a b c d]);grid on;

See Figure 1.25.
Free download pdf