Basic Discrete-Time Signals

Một phần của tài liệu Signals and systems using matlab (Trang 482 - 495)

CHAPTER 8 Discrete-Time Signals and Systems

8.2.4 Basic Discrete-Time Signals

The representation of discrete-time signals via basic signals is simpler than in the continuous-time domain. This is due to the lack of ambiguity in the definition of the impulse and the unit-step discrete-time signals. The definitions of impulses and unit-step signals in the continuous-time domain are more abstract.

Discrete-Time Complex Exponential

Given complex numbers A= |A|ejθ and α= |α|ejω0, a discrete-time complex exponential is a signal of the form

x[n]=Aαn

= |A||α|nej(ω0n+θ)

= |A||α|n[cos(ω0n+θ)+jsin(ω0n+θ)] (8.16) whereω0is a discrete frequency in radians.

Remarks

n The discrete-time complex exponential looks different from the continuous-time complex exponential. This can be explained by sampling the continuous-time complex exponential

x(t)=Ae(−a+j0)t

(for simplicity we let A be real) using as sampling period Ts. The sampled signal is x[n]=x(nTs)=Ae(−anTs+j0nTs)=A(eaTs)nej(0Ts)n

=Aαnejω0n where we letα=eaTs andω0=0Ts.

n Just as with the continuous-time complex exponential, we obtain different signals depending on the chosen parameters A andα. For instance, the real part of x[n]in Equation (8.16) is a real signal

g[n]=Re[x[n]]= |A||α|ncos(ω0n+θ)

where when|α|<1it is a damped sinusoid, and when|α|>1it is a growing sinusoid (see Figure 8.3).

Ifα=1then the above signal is a sinusoid.

n It is important to realize that forα >0the real exponential

x[n]=(−α)n=(−1)nαnncos(πn)

nExample 8.12

Given the analog signal

x(t)=eatcos(0t)u(t)

determine the values ofa>0,0, andTsthat permit us to obtain a discrete-time signal y[n]=αncos(ω0n) n≥0

8.2 Discrete-Time Signals 467

−6 −4 −2 0 2 4 6

0 1 2 3 4

n

x1[n]=(0.8)n x2[n]=1.25n

−6 −4 −2 0 2 4 6

n 0

1 2 3 4

−5 0 5

−4

−2 0 2 4

n y1[n]

−5 0 5

−4

−2 0 2 4

n y2[n]

(a)

(b) FIGURE 8.3

(a) Real exponentialx1[n]=0.8n,x2[n]=1.25n, and (b) modulated exponentialy1[n]=x1[n] cos(πn)and y2[n]=x2[n] cos(πn).

and zero otherwise. Consider the case whenα=0.9 and ω0 =π/2. Find a,0, and Ts that will permit us to obtainy[n] fromx(t)by sampling. Plotx[n] andy[n] using MATLAB.

Solution

Comparing the sampled continuous-time signal x(nTs)=(eaTs)ncos((0Ts)n)u[n] withy[n] we obtain the following two equations:

α=eaTs ω0 =0Ts

with three unknowns (a,0, andTs), so there is no unique solution. According to the Nyquist sampling rate condition,

Ts≤ π

max

Assuming the maximum frequency ismax=N0forN≥2 (since the signal is not band limited the maximum frequency is not known; to estimate it we could use Parseval’s result as indicated in Chapter 7, instead we are assuming that it is a multiple of0), if we letTs=π/N0after replacing it in the above equations, we get

α=eaπ/N0

ω0=0π/N0=π/N If we wantα=0.9 andω0 =π/2, we have thatN=2 and

a= −20

π log 0.9

for any frequency0>0. For instance, if0=2π, thena= −4 log 0.9 andTs=0.25. Figure 8.4 displays the continuous- and the discrete-time signals generated using the above parameters. The following script is used. The continuous-time and the discrete-time signals coincide at the sample times.

%%%%%%%%%%%%%%%%%%%%%

% Example 8.12

%%%%%%%%%%%%%%%%%%%%%

a =−4∗log(0.9);Ts = 0.25; % parameters alpha = exp(−a∗Ts);

n = 0:30; y = alpha.ˆn.∗cos(pi∗n/2); % discrete-time signal

t = 0:0.001:max(n)∗Ts; x = exp(−a∗t).∗cos(2∗pi∗t); % analog signal stem(n, y, ’r’); hold on

plot(t/Ts, x); grid; legend(’y[n]’, ’x(t)’); hold off

FIGURE 8.4

Determination of parameters for a continuous-time signalx(t)that when sampled gives a desired discrete-time signaly[n].

0 5 10 15 20 25 30

−1

−0.8

−0.6

−0.4

−0.2 0 0.2 0.4 0.6 0.8 1

t/Ts

x(t), y[n]

y[n]

x(t)

n

8.2 Discrete-Time Signals 469

nExample 8.13

Show how to obtain the discrete-time exponentialx[n]=(−1)n forn≥0 and zero otherwise, by sampling a continuous-time signalx(t).

Solution

Because the values ofx[n] are 1 and−1,x[n] cannot be generated by sampling a real exponential signaleatu(t); indeed,eat>0 for any values ofaandt. The discrete signal can be written as

x[n]=(−1)n=cos(πn)

forn≥0. If we sample an analog signalx(t)=cos(0t)u(t)with a sampling periodTs, we get x[n]=x(nTs)=cos(0nTs)=cos(πn) n≥0

and zero otherwise. Thus,0Ts=π, givingTs=π/0. For instance, for0=2π, thenTs=0.5. n Discrete-Time Sinusoids

Discrete-time sinusoids are a special case of the complex exponential. Lettingα=ejω0andA= |A|ejθ, we have according to Equation (8.16),

x[n]=Aαn= |A|ej(ω0n+θ)= |A|cos(ω0n+θ)+j|A|sin(ω0n+θ) (8.17) so the real part ofx[n] is a cosine, while the imaginary part is a sine. As indicated before, discrete sinusoids of amplitudeAand phase shiftθare periodic if they can be expressed as

Acos(ω0n+θ)=Asin(ω0n+θ+π/2) −∞<n<∞ (8.18) wherew0 =2πm/Nrad is the discrete frequency for integersmandN>0, which are not divisible by each other. Otherwise, discrete-time sinusoids are not periodic.

Becauseωis given in radians, it repeats periodically with 2πas the period—that is,

ω=ω+2πk k integer (8.19)

To avoid this ambiguity, we will let−π < ω≤πas the possible range of discrete frequencies. This is possible since

ω=

ω−2πk whenω >2π, for somek>0 integer

ω−2π 0≤ω≤2π (8.20)

See Figure 8.5. Thus, sin(3πn)equals sin(πn), and sin(1.5πn)equals sin(−0.5πn)= −sin(0.5πn).

FIGURE 8.5

Discrete frequenciesω.

ω=π/2, 5π/2, 9π/2 ã ã ã =π/2

ω=3π/2, 7π/2, 11π/2 , ããã =−π/2

ω=0, 2π, 4π, ããã =0 ω=π, 3π, 5π ããã =π=−π

nExample 8.14

Consider the following four sinusoids:

(a)x1[n]=sin(0.1πn) (b)x2[n]=sin(0.2πn) (c)x3[n]=sin(0.6πn) (d)x4[n]=sin(0.7πn)

Find if they are periodic, and if so, determine their periods. Are these signals harmonically related? Use MATLAB to plot these signals fromn=0,. . ., 40. Comment on which of these signals resemble sampled analog sinusoids.

Solution

To find if they are periodic, rewrite the given signals as follows indicating that the signals are periodic of periods 20, 10, 10, and 20:

(a)x1[n]=sin(0.1πn)=sin 2π

20n

(b)x2[n]=sin(0.2πn)=sin 2π

10n

(c)x3[n]=sin(0.6πn)=sin 2π

103n

(d)x4[n]=sin(0.7πn)=sin 2π

207n

If we letω1=2π/20, the frequencies ofx2[n],x3[n], andx4[n] are 2ω1, 6ω1, and 7ω1, respectively;

thus they are harmonically related. Also, one could consider the frequencies ofx1[n] and x4[n]

harmonically related (i.e., the frequency of x4[n] is seven times that of x1[n]), and likewise the frequencies of x2[n] andx3[n] are also harmonically related, with the frequency of x3[n] being

8.2 Discrete-Time Signals 471

0 10 20

(a) (b)

(c) (d)

30 40

−1

−0.5 0 0.5 1

−1

−0.5 0 0.5 1

−1

−0.5 0.5 0 1

−1

−0.5 0 0.5 1

n

0 10 20 30 40

n

x1[n]x3[n] x4[n]x2[n]

0 10 20 30 40

n

0 10 20 30 40

n

FIGURE 8.6

Periodic signalsxi[n],(a)i=1,(b)i=2,(c)i=3, and(d)i=4, given in Example 8.14.

three times that ofx2[n]. When plotting these signals using MATLAB, the first two resemble analog

sinusoids but not the other two. See Figure 8.6. n

Remarks

n The discrete-time sine and cosine signals, as in the continuous-time case, are out of phaseπ/2radians.

n The discrete frequencyωis given in radians since n, the sample index, does not have units. This can also be seen when we sample a sinusoid using a sampling period Tsso that

cos(0t)|t=nTs=cos(0Tsn)=cos(ω0n)

where we definedω0=0Ts, and since0has rad/sec as units and Tshas seconds as units, thenω0has radians as units.

n The frequency of analog sinusoids can vary from 0 (dc frequency) to. Discrete frequenciesω as radian frequencies can only vary from0 toπ. Negative frequencies are needed in the analysis of real- valued signals; thus−∞<  <∞and−π < ω≤π. A discrete-time cosine of frequency0is constant for all n, and a discrete-time cosine of frequencyπ varies from−1to1from sample to sample, giving the largest variation possible for the discrete-time signal.

Discrete-Time Unit-Step and Unit-Sample Signals

The unit-stepu[n]and the unit-sampleδ[n]discrete-time signals are defined as

u[n]=

(1 n≥0

0 n<0 (8.21)

δ[n]=

(1 n=0

0 otherwise (8.22)

These two signals are related as follows:

δ[n]=u[n]−u[n−1] (8.23)

u[n]= X∞

k=0

δ[nk]= n X m=−∞

δ[m] (8.24)

It is easy to see the relation between the two signalsu[n] andδ[n]:

δ[n]=u[n]−u[n−1]

u[n]=δ[n]+δ[n−1]+ ã ã ã

=

X

k=0

δ[nk]=

n

X

m=−∞

δ[m]

where the last expression is obtained by a change of variable,m=nk. These two equations should be contrasted with the ones foru(t)andδ(t). Instead of the derivative relation δ(t)=du(t)/dt, we have a difference relation, and instead of the integral connection

u(t)= Zt

−∞

δ(τ)dτ

we now have a summation relation betweenu[n] andδ[n].

Remarks Notice that there is no ambiguity in the definition of u[n]orδ[n]as there is for their continuous- time counterparts u(t)andδ(t). Moreover, the definitions of these functions do not depend on u(t)orδ(t), and u[n]andδ[n]are not sampled versions of u(t)andδ(t).

Generic Representation of Discrete-Time Signals

Any discrete-time signalx[n]is represented using unit-sample signals as

x[n]= X∞

k=−∞

x[k]δ[nk] (8.25)

8.2 Discrete-Time Signals 473

The representation of any signalx[n] in terms ofδ[n] results from thesifting propertyof the unit-sample signal:

x[n]δ[nn0]=x[n0]δ[nn0]

which is due to

δ[nn0]=

(1 n=n0 0 otherwise

Thus, consideringx[n] a sequence of samples

. . . x[−1]x[0]x[1] . . .

at times. . . −1, 0, 1,. . ., we can writex[n] as

x[n]= ã ã ã +x[−1]δ[n+1]+x[0]δ[n]+x[1]δ[n−1]+ ã ã ã

=

X

k=−∞

x[k]δ[nk]

The generic representation (Eq. 8.25) of any signal x[n] will be useful in finding the output of a discrete-time linear time-invariant system.

nExample 8.15

Use the generic representations in terms of unit-sample signals to represent the ramp signal r[n]

defined as

r[n]=nu[n]

and from it show that

r[n]=

n

X

m=0

(nm)−

n

X

m=1

(nm)

Solution

Using the unit-sample signal generic representation, we have

r[n]= X∞ k=−∞

(ku[k])δ[nk]= X∞ k=0

kδ[nk]=0δ[n]+1δ[n−1]+2δ[n−2]+ ã ã ã

Lettingm=nk, we write the above equation as

r[n]=

n

X

m=−∞

(nm)δ[m]=

n

X

m=−∞

(nm)(u[m]−u[m−1])

=

n

X

m=0

(nm)−

n

X

m=1

(nm)=n+

n

X

m=1

(nm)−

n

X

m=1

(nm)=n n≥0

Forn<0,r[n]=0. n

nExample 8.16

Consider a discrete pulse

x[n]=

1 0≤nN−1 0 otherwise

Obtain representations ofx[n] using unit-sample and unit-step signals.

Solution

The signalx[n] can be represented as

x[n]=

N−1

X

k=0

δ[nk]

and usingδ[n]=u[n]−u[n−1], we obtain a representation of the discrete pulse in terms of unit- step signals,

x[n]=

N−1

X

k=0

(u[nk]−u[nk−1])=(u[n]−u[n−1])+(u[n−1]−u[n−2]) + ã ã ã −u[nN]

=u[n]−u[nN]

because of the cancellation of consecutive terms. n

8.2 Discrete-Time Signals 475

nExample 8.17

Consider how to generate a train of triangular, discrete-time pulsest[n], which is periodic of period N=11. A period oft[n] is

τ[n]=

n 0≤n≤5

n+10 6≤n≤10

0 otherwise

Find then an expression for its finite differenced[n]=t[n]−t[n−1].

Solution

The periodic signal can be generated by adding shifted versions ofτ[n], or t[n]= ã ã ã +τ[n+11]+τ[n]+τ[n−11]+ ã ã ã =

X∞ k=−∞

τ[n−11k]

The finite differenced[n] is then

d[n]=t[n]−t[n−1]

= X∞ k=−∞

(τ[n−11k]−τ[n−1−11k])

The signald[n] is also periodic of the same periodN=11 ast[n]. If we let

s[n]=τ[n]−τ[n−1]=

1 0≤n≤5

−1 6≤n≤10 0 otherwise then

d[n]=

X

k=−∞

s[n−11k]

When sampled, these two signals look very much like the continuous-time train of triangular

pulses, and its derivative. n

nExample 8.18

Consider the discrete-time signal

y[n]=3r(t+3)−6r(t+1)+3r(t)−3u(t−3)|t=0.15n

obtained by sampling a continuous-time signal formed by ramp and unit-step signals with a sampling periodTs=0.15. Write MATLAB functions to generate the ramp and the unit-step signals and obtainy[n]. Then write a MATLAB function that provides the even and the odd decomposition ofy[n].

Solution

The real-valued signal is obtained by sequentially adding the different signals as we go from−∞

to∞:

y(t)=













0 t<−3

3r(t+3)=3t+9 −3≤t<−1 3t+9−6r(t+1)= −3t+3 −1≤t<0

−3t+3+3r(t)=3 0≤t<3

3−3=0 t≥3

The three functions ramp, ustep, and evenodd for this example are shown below. The following script shows how they can be used to generate the ramp signals, with the appropriate slopes and time shifts, as well as the unit-step signals with the desired delay, and then how to compute the even and the odd decomposition ofy[n].

%%%%%%%%%%%%%%%%%%%%

% Example 8.18

%%%%%%%%%%%%%%%%%%%%

Ts = 0.15; % sampling period t =−5:Ts:5; % time support

y1 = ramp(t, 3, 3); y2 = ramp(t,−6, 1); y3 = ramp(t, 3, 0); % ramp signals y4 =−3∗ustep(t,−3); % unit-step signal

y = y1 + y2 + y3 + y4;

[ze, zo] = evenodd(t, y);

We choose as support−5≤t≤5 for the continuous-time signaly(t), which translates into a sup- port−5≤0.15n≤5 or−5/0.15≤n≤5/0.15 for the discrete-time signal. Since the limits are not integers, to make them integers (as required becausenis an integer) we use the MATLAB function ceilto find integers larger than−5/0.15 and 5/0.15 giving a range [−33, 33]. This is used when plottingy[n].

The following function generates a ramp signal for a range of time values, for different slopes and time shifts.

function y = ramp(t, m, ad)

% ramp generation

% t: time support

% m: slope of ramp

% ad : advance (positive), delay (negative) factor

8.2 Discrete-Time Signals 477

N = length(t);

y = zeros(1, N);

for i = 1:N, if t(i)>=−ad, y(i) = m∗(t(i) + ad);

end end

Likewise, the following function generates unit-step signals with different time shifts (notice the similarities with therampfunction).

function y = ustep(t, ad)

% generation of unit step

% t: time support

% ad : advance (positive), delay (negative) N = length(t);

y = zeros(1, N);

for i = 1:N, if t(i)>=−ad, y(i) = 1;

end end

Finally, the following function can be used to compute the even and the odd decomposition of a discrete-time signal. The MATLAB functionflliplrreflects the signal as needed in the generation of the even and the odd components.

function [ye, yo] = evenodd(y)

% even/odd decomposition

% NOTE: the support of the signal should be

% symmetric about the origin

% y: analog signal

% ye, yo: even and odd components yr = fliplr(y);

ye = 0.5∗(y + yr);

yo = 0.5∗(y−yr);

The results are shown in Figure 8.7. The discrete-time signal is given as

y[n]=













0 n≤ −21 0.45n+9 −20≤n≤ −6

−0.45n+3 −7≤n≤0

3 1≤n≤19

0 n≥20

n

−30 −20 −10 0

) c ( )

a (

(b)

10 20 30

−1 0 1 2 3 4 5 6 7

y[n]

n

−30 −20 −10 0 10 20 30

−1 0 1 2 3 4 5

ze[n]

−30 −20 −10 0 10 20 30

−2

−1 0 1 2

n n

zo[n]

FIGURE 8.7

(a) Discrete-time signal, and (b) even and (c) odd components.

Một phần của tài liệu Signals and systems using matlab (Trang 482 - 495)

Tải bản đầy đủ (PDF)

(769 trang)