Sei sulla pagina 1di 31

Discrete-Time Signals: Review

LEARNING OBJECTIVES

Develop the notion of a discrete-time (d-t) signal and a d-t x[n] system. Define a d-t signal and its properties, ... and perform operations on these signals. -4 -3 -2 -1
x[n] x[n] -N
2

...
0 1 2 3 5

x[n-N]

x[n]

x[-n] x[2n]

a[n]

+/b[n]

y[n]

x[n]

y[n]

x[2n] x[n]

Tutorial:

b[n] or scaling by c

Solve problems related to the above. MATLAB Exercises Chap. 1, Digital Signal Processing, Sanjit K. Mitra.
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T1

Discrete-Time Signals: Review

Discrete-Time Signals

A discrete-time signal is an indexed sequence of real or complex numbers. Thus, it is function of an integer-valued variable, n and is x[n] = (... 2 4 3 3 2 0 2 2 5 ...) denoted by x[n]. x[n] is generally referred to as a function of time. A d-t signal is undefined for noninteger values of n. A real-valued signal x[n] will be represented graphically in the form of a lollipop plot as shown.
AFMH

x[n]

...
-4 -3 -2 -1 0 1 2 3 5

...

Created: June 1999

Last update: July 2010

DSP_L1_T2

Discrete-Time Signals: Review

Generating a D-T Signal or Sequence

Discrete-time signals or sequences are often derived by sampling a xa(t) continuous-time signal, such as speech, with an analog-to-digital (A/D) converter. t For example, a c-t signal xa(t) that is sampled at a rate of fs=1/Ts samples A/D per second produces the sampled signal x[n], which is related to xa(t) as xa(t) follows: x[n] Sampling x[n] = xa(nTs) interval, Ts Not all d-t signals are obtained in this n manner. Eg. Daily stock market -4 -3 -2 -1 0 1 2 3 5 prices, population statistics, etc. Created: Last update: DSP_L1_T3 AFMH June 1999 July 2010

Discrete-Time Signals: Review

z[ n] = (..., a + jb, c + jd ,...)

Complex Sequences

In general, a d-t signal may be complex-valued. In digital communications, complex signals arise naturally. A general complex signal x(t) may be expressed either in terms of its real and imaginary parts, z = a + jb z[n] = Re{z[n]} + j Im{z[n]} or in polar form in terms of its magnitude and phase, z[n] = |z[n]| exp[j arg{z[n]}] z = rei
Im

The magnitude may be derived as follows: |z[n]|2 = Re2{z[n]} + Im2{z[n]} The phase may be found using arg{z[n]} = tan-1[Im{z[n]}/Re{z[n]}]

b a -b

z[n]
tan-1 b/a Re

z*[n]

If z[n] is a complex sequence, the complex conjugate denoted by z*[n] is formed by changing the sign on the imaginary part of z[n]: z*[n] = Re{z[n]} - j Im{z[n]} = |z[n]| exp[-j arg{z[n]}]
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T4

Discrete-Time Signals: Review

Fundamental Sequences: Unit Impulse Sequence [n]


[n] 1

The unit impulse (or unit sample) sequence [n], is defined as

1 n = 0 [ n] = 0 n 0
The delayed/shifted unit impulse/sample sequence [n-k] is defined by

-2-1 0 1 2 3

1 n = k [n k ] = 0 n k

[n-k] 1 ... -2 -1 0 1 2
AFMH Created: June 1999

k
Last update: July 2010

n
DSP_L1_T5

Discrete-Time Signals: Review

Fundamental Sequences: Unit Step Sequence u[n]

The unit step sequence u[n], is defined as

1 n 0 u[n] = 0 n < 0

u[n] 1 ... n

Value of u[n] at n=0 is defined and equals -2 -1 0 1 2 3 4 5 to unity (unlike c-t step function, u(t)). The shifted unit step sequence u[n-k] is defined as

u[n-k] 1 ... -2 -1 0 1 2 k
Last update: July 2010

1 n k u[n k ] = 0 n < k

n
DSP_L1_T6

AFMH

Created: June 1999

Discrete-Time Signals: Review

Fundamental Sequences: Unit Impulse Sequence

From the definitions of [n] and [n-k], it is readily seen that

x [ n ] [ n ] = x [ 0 ] [ n ] x [ n ] [ n k ] = x [ k ] [ n k ] u[n ] =

Note that [n] and u[n] are related by

k =

[ k ],

[ n ] = u [ n ] u [ n 1]
Any sequence x[n] can be expressed as (see DSP_L1_T24)

x[ n ] =

k =

x[ k ] [ n k ]
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T7

Discrete-Time Signals: Review

Fundamental Sequences: Complex Exponential Sequences

An exponential sequence is given as

x[n] = A n , A and may real or complex numbers i.e.

= exp( o + jo ), and A = A exp( j ).


The complex exponential sequence is of the form

x[n] = A e n + j ( n + )
o o

= Ae

on

cos(o n + ) + j A e
AFMH

on

sin(o n + )
Last update: July 2010 DSP_L1_T8

Created: June 1999

Discrete-Time Signals: Review

Fundamental Sequences: Complex Exponential Sequences

The real sinusoidal sequence with a constant amplitude is of the form

x[n] = A cos(o n + )
amplitude angular frequency initial phase

For x[n] (with o=0 for complex seq) to be periodic with period N, 0 must satisfy the following condition

0 m = 2 N

m = positive integer

The smallest N yields the fundamental period of sequence,N0

2 N0 = 0

1 = f 0
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T9

Discrete-Time Signals: Review

Fundamental Sequences: Complex-valued Exponential Sequences


Real part 2 Amplitude 1 0 -1 -2

% Generation of a complex exp. sequence 1 x[n] = 2 exp( 12 + j )n 6 clf; c = -(1/12)+(pi/6)*i; K = 2; n = 0:40; x = K*exp(c*n); subplot(2,1,1); stem(n,real(x)); xlabel('Time index n');ylabel('Amplitude'); title('Real part'); subplot(2,1,2); stem(n,imag(x)); xlabel('Time index n');ylabel('Amplitude'); title('Imaginary part');

2e

1 12 n

cos 212n

10

15

20 25 Time index n Imaginary part

30
1 12 n

35

40

2e

sin 212n

Amplitude

-1

10

15

20 25 Time index n

30

35

40

Ref: Program P1_2, DSP Lab using Matlab, Mitra

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T10

Discrete-Time Signals: Review

Fundamental Sequences: Period Complex-valued Exponential Sequences

% Generate periodic complex sequence x[n] = exp( j 10 )n % n=[0:40]; x=exp((j*pi/10)*n); subplot(2,2,1); stem(n, real(x)) % real part subplot(2,2,2); stem(n, imag(x)) % imaginary part subplot(2,2,3); stem(n, abs(x)) % magnitude subplot(2,2,4); stem(n, angle(x)*(180/pi)) % phase in degrees

Real part 1 0.5 0 -0.5 -1 1 0.5 0 -0.5 -1

Imaginary part

10

20 Magnitude

30

40

10

20

30

40

Phase 200 100 0

1 0.8 0.6 0.4 0.2 0 0 10 20 30 40

-100 -200 0

10

20

30

40

Ref: Program P1_2new

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T11

Discrete-Time Signals: Review

Fundamental Sequences: Real-valued Exponential Sequences


% Generation of a real exp.l sequence clf; n = 0:35; a = 1.2; K = 0.2; x = K*a.^n; stem(n,x); xlabel('Time index n');ylabel('Amplitude');

120

100

80 Amplitude

60

40

20

0 0

10

15 20 Time index n

25

30

35

Ref: Program P1_3, DSP Lab using Matlab, Mitra

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T12

Discrete-Time Signals: Review

Fundamental Sequences: Sinusoidal Sequences

A sinusoidal sequence can be expressed as

x[ n ] = A cos( 0 n + )
If n is dimensionless, then both 0 and have units of radians.

x[n]=cos(n/6)

-6 -12 -9 -3 0 3

6 9 12 n

Sequence above is periodic with fundamental period 12.


AFMH Created: June 1999 Last update: July 2010 DSP_L1_T13

Discrete-Time Signals: Review

Fundamental Sequences: Sinusoidal Sequences

% Generation of a sinusoidal sequence n = 0:40; f = 0.1; phase = 0; A = 1.5; arg = 2*pi*f*n - phase; x = A*cos(arg); clf; % Clear old graph stem(n,x);% Plot the generated sequence axis([0 40 -2 2]); grid; title('Sinusoidal Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis;
Ref: Program P1_4, DSP Lab using Matlab, Mitra

Sinusoidal Sequence 2 1.5 1 0.5 Amplitude 0 -0.5 -1 -1.5 -2

10

15

20 25 Time index n

30

35

40

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T14

Discrete-Time Signals: Review

Symmetric Sequences
x[n]

A real-valued sequence x[n] is said to be even if, for all n x[n] = x[-n] whereas it is said to be odd if, for all n x[n] = -x[-n]

0 x[n]

Any signal x[n] can be decomposed into a sum of its even part xe[n], and its odd part xo[n], as n 0 follows: x[n] = xe[n] + xo[n], Example: where x[n]=(3 6 2 10 1 8 5) x[-n]=(5 8 1 10 2 6 3) xe[n] = 1/2 {x[n]+x[-n]}, xo[n] = 1/2 {x[n]-x[-n]}. xe[n]=(4 7 1.5 10 1.5 7 4) xo[n]=(-1 -1 0.5 0 0.5 1 1)
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T15

Discrete-Time Signals: Review

Symmetric Sequences (Complex)


Im

A complex sequence x[n] is said to be all n

conjugate symmetric (see note below) if, for


x[n] = x*[-n]
Im

a + jb
Re

a jb

whereas it is said to be conjugate antisymmetric if, for all n x[n] = -x*[-n]

a + jb

a + jb
Re

See Example 2.5 in Mitra for conjugate -symmetric sequence Note: A sequence that is conjugate symmetric is sometimes said to be hermitian. See Example 2.5 in Mitra for conjugate -symmetric sequence
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T16

Discrete-Time Signals: Review

Periodic and Aperiodic Sequences

A sequence (discrete-time signal) x[n] is said to be periodic with period N if for some positive real integer N for which x[n] x[n] = x[n+N] for all n Sequence repeats itself every N samples See TP DSP_L1-T8

It follows that x[n+mN] = x[n] for all n and any integer m Sequence is also periodic with period 2N, period 3N, and all other integer multiples of N The fundamental period N0 of x[n] is the smallest positive integer for which the above equation is satisfied. If the equation is not satisfied for any integer N, x[n] is said to be aperiodic. Created: Last update:
AFMH June 1999 July 2010

-N

DSP_L1_T17

Discrete-Time Signals: Review

Exercises

Determine whether or not the following signals are periodic and, for each sequence that is periodic, determine the fundamental period.

(a) x[n] = cos(0.125n) (b) x[n] = Re{e jn / 12 } + Im{e jn / 18 } (c) x[n] = sin( + 0.2n) (d) x[n] = e
j

16

cos(n / 17)

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T18

Discrete-Time Signals: Review

Solutions

(a) x[n] = cos(0.125n)


Because 0.125 = /8, From TP DSP_L1_T8, we have 0 = /8, and For x[n] to be periodic with period N, 0 must satisfy the following condition 0/2 = m/N (=1/16) Therefore, cos(/8 n) = cos(/8 (n+16))
N0 = 2

x[n] is periodic with fundamental period N0 = 16.


Try plotting - adapt Matlab code on DSP_L1_T13
AFMH

2 8

= 16

Created: June 1999

Last update: July 2010

DSP_L1_T19

Discrete-Time Signals: Review

Solutions

(b) x[n] = Re{e jn / 12 } + Im{e jn / 18 }


Here we have the sum of two periodic signals

x[n] = cos(n / 12) + sin(n / 18)


Note: If x1[n] is a sequence with period N1, and x2[n] is another sequence with period N2, the sum x[n]=x1[n]+x2[n] will always be periodic with a fundamental period

N=

N1 N 2 where gcd(N1, N2) means greatest common divisor of N1 and N2. gcd( N1 , N 2 )

The same is true for x[n]=x1[n]x2[n]; however, the fundamental period may be smaller

Therefore, the period of the sum is

01 = / 12, 02 = / 18
N1 = 2/ = 24, N 2 = 2/ = 36 12 18 N=
( 24 )(36 ) gcd( 24,36 )

( 24 )(36 ) = 12
Created: June 1999

72
Last update: July 2010 DSP_L1_T20

AFMH

Discrete-Time Signals: Review

Solutions

(c) x[n] = sin( + 0.2n)


In order for this sequence to be periodic, we must be able to find a value for N such that

sin( + 0.2n) = sin( + 0.2(n + N ))


The sine function is periodic with a period 2. Therefore, 0.2N must be an integer multiple of 2. However, because is an irrational number, no integer value of N exists that will make the equality true. Thus, this sequence is aperiodic.

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T21

Discrete-Time Signals: Review

Solutions
j

16

(d) x[n] = e

cos(n / 17)

Here we have the product of two periodic signals, Therefore, the period of the sum is

01 = / 16, 02 = / 17
N1 = 2/ = 32, N 2 = 2/ = 34 16 17 N=
( 32 )(34 ) gcd(32,34 )

( 32 )(34 ) = 544 2

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T22

Discrete-Time Signals: Review

Signal Manipulation: Shifting, Reversal, Time scaling


x[n] -2-1 0 1 2 3 4 5 6 x[n-2] -2-1 0 1 2 3 4 5 6 x[-n] n

Note: The operations below are order-dependent. Shifting If y[n]=x[n-n0], x[n] is shifted to the right by n0 samples (delay), given n0 positive Reversal Given y[n]=x[-n] (simply involves flipping the sequence x[n] w.r.t. to index n)

-8-7 -6-5-4-3-2-10 n Time scaling Given y[n]=x[Mn] or y[n]=x[n/N] where M and N are positive integers. Up-sampling by Down-sampling x[2n] x[n/2]
by a factor of 2 a factor of 2

-2-1 0 1 2 3 4 5 6

-2 -1 0 1 2 3 4 5 6 7 8 9 10 11
AFMH Created: June 1999

n
Last update: July 2010 DSP_L1_T23

Discrete-Time Signals: Review

Signal Manipulation: Addition, Multiplication, Scaling

Addition The sum of 2 sequences, y[n]=a[n]+b[n] is formed by the pointwise addition of the two sequences. Multiplication (or modulation) The product of 2 sequences, y[n]=a[n]b[n] is formed by the pointwise product of the two sequences.

n a[n] b[n] Addition a[b]+b[n]

-1 2 3 5

0 -1 5 4 -5 -3

1 0 -2 -2 0 0

2 4 7 11 28 12

3 7 4 11 28 21

4 3 -5 8 -15 9

Multiplication 6 a[n]b[n] 6

Scaling Scaling (or scalar multiplication) 3 a[n] Amplitude scaling by a constant c, y[n] = cx[n] is accomplished by multiplying every sample value by c.
AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T24

Discrete-Time Signals: Review

Signal Manipulation: Shifting, Reversal, Time scaling

The unit sequence may be used to decompose an arbitrary sequence x[n] into a sum of weighted and shifted unit samples as follows:
x(n) = ... + x(1) (n + 1) + x(0) (n) + x(1) (n 1) + x( 2) (n 2) + ... = ... + 1. (n + 1) + 0. (n) + 1. ( n 1) + 2. (n 2) + 3. (n 3) + 2. ( n 4) + 1. (n 5) + ...

x[n]

x[n] = (...1 0 1 2 3 2 1...)


This decomposition may be written concisely as:
-1 0 1 2 3 4 5

x ( n) =

k =

x(k ) (n k )
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T25

Discrete-Time Signals: Review

Exercises
1 2 x(n ) = 3 0 n = 0 n = 1 n = 2 else

Express the sequence

as a sum of scaled and shifted unit steps.

AFMH

Created: June 1999

Last update: July 2010

DSP_L1_T26

Discrete-Time Signals: Review

Solution

There are several ways to derive the signal decomposition. (a) Express as a sum of weighted and shifted unit samples
x(n) = (n) + 2 (n 1) + 3 ( n 2) (n) = u (n) u (n 1) Use the fact: Therefore x(n) = u(n) u(n 1) + 2[u(n 1) u(n 2)]+ 3[u(n 2) u(n 3)]

= u(n) + u(n 1) + u(n 2) 3u(n 3) (b) Derive directly as follows: Decomposition should begin with a unit step which generates a value of 1 at index n=0. Because x(n) increases to a value of 2 at n=1, we must add a delayed unit step u(n-1). At n=2, x(n) again increases in amplitude by 1, so we add the delayed unit step u(n-2). We then bring the sequence back to zero for n>=3 by subtracting the delayed unit step 3u(n-3).
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T27

Discrete-Time Signals: Review

Application Example #1 Signal Smoothing


1 y[n] = ( x[n 1] + x[n] + x[n + 1]) 3
8 6 Amplitude 4 2 0 -2 0 5 10 15 20 25 30 Time index n 35 40 45 50 d[n] s[n] x[n]

A common DSP application is the removal of noise from a signal corrupted by additive noise. A simple 3-point moving average algorithm is given by:
% Signal Smoothing by Averaging clf; % Generate random noise, d[n] R = 51; d = 0.8*(rand(R,1) - 0.5); % Generate uncorrupted signal, s[n] m = 0:R-1; s = 2*m.*(0.9.^m); % Generate noise corrupted signal, x[n] x = s + d'; subplot(2,1,1); plot(m,d','r-',m,s,'g--',m,x,'b-.'); xlabel('Time index n');ylabel('Amplitude'); legend('d[n] ','s[n] ','x[n] '); % do smoothing x1 = [0 0 x];x2 = [0 x 0];x3 = [x 0 0]; y = (x1 + x2 + x3)/3; subplot(2,1,2); plot(m,y(2:R+1),'r-',m,s,'g--'); legend( 'y[n] ','s[n] '); xlabel('Time index n');ylabel('Amplitude');
Ref: Program P1_5, DSP Lab using Matlab, Mitra

8 6 4 2 0 y[n] s[n]

Amplitude

10

15

20 25 30 Time index n Created: June 1999

35

40

45

50

AFMH

Last update: July 2010

DSP_L1_T28

Discrete-Time Signals: Review

Application Example #2 Amplitude Modulation

An amplitude modulated signal can be generated by modulating a highfrequency sinusoidal signal, xH [ n] = cos( H n) with a low-frequency sinusoidal signal, xL [ n] = cos( L n) . The resulting signal is of the form: where m is the modulation index.

y[ n] = A(1 + m.xL [n]) xH [ n] = A(1 + m. cos( L n)) cos( H n)


1.5

Amplitude

% Generation of amplitude modulated seq clf; n = 0:100; m = 0.4;fH = 0.1; fL = 0.01; xH = sin(2*pi*fH*n); xL = sin(2*pi*fL*n); y = (1+m*xL).*xH; stem(n,y);grid; xlabel('Time index n');ylabel('Amplitude');

0.5

-0.5

-1

-1.5

10

20 AFMH

30

40 50 60 Time index n Created: June 1999

70

80

90

100

Ref: Program P1_6, DSP Lab using Matlab, Mitra

Last update: July 2010

DSP_L1_T29

Discrete-Time Signals: Review

Application Example #2 Amplitude Modulation

y[ n] = A(1 + m.xL [n]) xH [ n] = A(1 + m. cos( L n)) cos( H n)


1.5

0.5

Amplitude

-0.5

-1

-1.5 0 10 20 30 40 50 Time index n AFMH Created: June 1999 Last update: July 2010 DSP_L1_T30 60 70 80 90 100

Discrete-Time Signals: Review

Application Example #3 Swept Frequency Sinusoidal Sequence


Swept-Frequency Sinusoidal Signal

% Generation of a swept freq sinusoidal seq 1.5 n = 0:100; a = pi/2/400; b = 0; 1 arg = a*n.*n + b*n; x = cos(arg); 0.5 clf; stem(n, x); 0 axis([0,100,-1.5,1.5]); title('Swept-Frequency Sinusoidal Signal'); -0.5 xlabel('Time index n'); ylabel('Amplitude'); -1 grid; axis;
Amplitude -1.5 0 10 20

30

40 50 60 Time index n

70

80

90

100

Note: To generate a swept-frequency sinusoidal signal whose frequency increases linearly with time, the argument of the sinusoidal signal must be a quadratic function of time. Assume the argument is of the form an2 + bn (i.e. the angular frequency is 2an + b since the frequency is the derivative of its phase w.r.t. time). Solve for values of a and b from the given conditions (minimum & maximum angular frequencies).
Ref: Program P1_7new, DSP Lab using Matlab, Mitra
AFMH Created: June 1999 Last update: July 2010 DSP_L1_T31

Potrebbero piacerti anche