dsp_lect_99.l1
Post on 17-Oct-2014
70 Views
Preview:
TRANSCRIPT
Created:June 1999
Last update:©AFMH DSP_L1_T1Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T1
Develop the notion of a discrete-time (d-t) signal and a d-t system.
Define a d-t signal and its properties,and perform operations on these signals.
☺ Tutorial:Solve problems related to the above.MATLAB Exercises
Chap. 1, ‘’Digital Signal Processing, Sanjit K. Mitra.
LEARNING OBJECTIVES
x[n]
n-4 -3 -2 -1 0 1 2 3 5
... ...
-Nx[n] x[n-N] x[-n]x[n]
x[2n]x[n]2
x[2n]x[n]2 b[n]
a[n] +/- y[n] x[n] xy[n]
b[n] or scaling by c
Created:June 1999
Last update:©AFMH DSP_L1_T2Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T2
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 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.
x[n]
n-4 -3 -2 -1 0 1 2 3 5
... ...
↑
= ...)522023342(...][nx
Created:June 1999
Last update:©AFMH DSP_L1_T3Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T3
• Discrete-time signals or sequences are often derived by sampling a continuous-time signal, such as speech, with an analog-to-digital (A/D) converter.
• For example, a c-t signal xa(t) that is sampled at a rate of fs=1/Ts samples per second produces the sampled signal x[n], which is related to xa(t) as follows:
x[n] = xa(nTs)• Not all d-t signals are obtained in this
manner. Eg. Daily stock market prices, population statistics, etc.
Generating a D-T Signal or Sequence
x[n]
n-4 -3 -2 -1 0 1 2 3 5
Samplinginterval, Ts
xa(t)
xa(t)
t
A/D
Created:June 1999
Last update:©AFMH DSP_L1_T4Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T4
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[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]}]
• The magnitude may be derived as follows:|z[n]|2 = Re2{z[n]} + Im2{z[n]}
• The phase may be found usingarg{z[n]} = tan-1[Im{z[n]}/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]}]
z = reiφ
z = a + jb
b
a Re
Im
tan-1 b/a
-b
z[n]
z*[n]
,...),(...,][ jdcjbanz ++=
Created:June 1999
Last update:©AFMH DSP_L1_T5Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T5
Fundamental Sequences:Unit Impulse Sequence
• The unit impulse (or unit sample) sequence δ [n], is defined as
• The delayed/shifted unit impulse/sample sequence δ[n-k] is defined by
⎩⎨⎧
≠=
=−
⎩⎨⎧
≠=
=
knkn
kn
nn
n
01
][
0001
][
δ
δ
δ[n]
1
n-2-1 0 1 2 3
δ[n-k]
1
n-2
...
-1 0 1 2 k
][nδ
Created:June 1999
Last update:©AFMH DSP_L1_T6Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T6
• The unit step sequence u[n], is defined as
• Value of u[n] at n=0 is defined and equals to unity (unlike c-t step function, u(t)).
• The shifted unit step sequence u[n-k] is defined as
Fundamental Sequences:Unit Step Sequence
⎩⎨⎧
<≥
=−
⎩⎨⎧
<≥
=
knkn
knu
nn
nu
01
][
0001
][u[n]
1
n-2
...
-1 0 1 2 3 4 5
u[n-k]
1
n-2
...
-1 0 1 2 k
][nu
Created:June 1999
Last update:©AFMH DSP_L1_T7Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T7
Fundamental Sequences:Unit Impulse Sequence
• From the definitions ofδ[n] and δ[n-k], it isreadily seen that
• Note that δ[n] and u[n]are related by
• Any sequence x[n] canbe expressed as(see DSP_L1_T24) ∑
∑
∞
−∞=
−∞=
−=
−−=
=
−=−=
k
n
k
knkxnx
nunun
knu
knkxknnxnxnnx
][][][
]1[][][
,][][
][][][][][]0[][][
δ
δ
δ
δδδδ
Created:June 1999
Last update:©AFMH DSP_L1_T8Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T8
Fundamental Sequences:Complex Exponential Sequences
An exponential sequence is given as
The complex exponential sequence is of the form
).exp()exp(
,][
φωσαα
α
jAAjA
Anx
oo
n
=+=
=
and,i.e. numberscomplex or realmay and
)sin()cos(
][ )(
φωφω σσ
φωσ
+++=
= ++
neAjneA
eAnx
on
on
njn
oo
oo
Created:June 1999
Last update:©AFMH DSP_L1_T9Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T9
Fundamental Sequences:Complex Exponential Sequences
The real sinusoidal sequence with a constant amplitude is of the form
For x[n] (with σo=0 for complex seq) to be periodic with period N, ω0must satisfy the following condition
The smallest N yields the fundamental period of sequence,N0
)cos(][ φω += nAnx o
amplitude angular frequency initial phase
integer positive== mNm
πω2
0
000
12f
N =⎟⎟⎠
⎞⎜⎜⎝
⎛=
ωπ
Created:June 1999
Last update:©AFMH DSP_L1_T10Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T10
Fundamental Sequences:Complex-valued Exponential Sequences
0 5 10 15 20 25 30 35 40-2
-1
0
1
2
Time index n
Ampl
itude
Real part
0 5 10 15 20 25 30 35 40-1
0
1
2
Time index n
Ampl
itude
Imaginary part
% Generation of a complex exp. sequence
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');
njnx )exp(2][ 6121 π+−=
122cos2 12
1 nne π−
122sin2 12
1 nne π−
Ref: Program P1_2, DSP Lab using Matlab, Mitra
Created:June 1999
Last update:©AFMH DSP_L1_T11Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T11
Fundamental Sequences:Period Complex-valued Exponential Sequences
% Generate periodic complex sequence%n=[0:40];x=exp((j*pi/10)*n);subplot(2,2,1);stem(n, real(x)) % real partsubplot(2,2,2);stem(n, imag(x)) % imaginary partsubplot(2,2,3);stem(n, abs(x)) % magnitudesubplot(2,2,4);stem(n, angle(x)*(180/pi))
% phase in degrees
njnx )exp(][ 10π=
0 10 20 30 40-1
-0.5
0
0.5
1
0 10 20 30 40-1
-0.5
0
0.5
1Real part Imaginary part
0 10 20 30 400
0.2
0.4
0.6
0.8
1
0 10 20 30 40-200
-100
0
100
200Magnitude Phase
Ref: Program P1_2new
Created:June 1999
Last update:©AFMH DSP_L1_T12Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T12
Fundamental Sequences:Real-valued Exponential Sequences
0 5 10 15 20 25 30 350
20
40
60
80
100
120
Time index n
Ampl
itude
% Generation of a real exp.l sequenceclf;n = 0:35; a = 1.2; K = 0.2;x = K*a.^n;stem(n,x);xlabel('Time index n');ylabel('Amplitude');
Ref: Program P1_3, DSP Lab using Matlab, Mitra
Created:June 1999
Last update:©AFMH DSP_L1_T13Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T13
Fundamental Sequences:Sinusoidal Sequences
• A sinusoidal sequence can be expressed as
If n is dimensionless, then both ω0 and θ have units of radians.
Sequence above is periodic with fundamental period 12.
)cos(][ 0 θω += nAnx
-12 -9-6
-3 0 36
9 12
x[n]=cos(πn/6)
n
Created:June 1999
Last update:©AFMH DSP_L1_T14Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T14
Fundamental Sequences:Sinusoidal Sequences
0 5 10 15 20 25 30 35 40-2
-1.5
-1
-0.5
0
0.5
1
1.5
2Sinusoidal Sequence
Time index n
Ampl
itude
% Generation of a sinusoidal sequencen = 0:40;f = 0.1;phase = 0;A = 1.5;arg = 2*pi*f*n - phase; x = A*cos(arg);clf; % Clear old graphstem(n,x);% Plot the generated sequenceaxis([0 40 -2 2]);grid; title('Sinusoidal Sequence');xlabel('Time index n');ylabel('Amplitude');axis;
Ref: Program P1_4, DSP Lab using Matlab, Mitra
Created:June 1999
Last update:©AFMH DSP_L1_T15Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T15
• 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]
• Any signal x[n] can be decomposed into a sum of its even part xe[n], and its odd part xo[n], as follows:
x[n] = xe[n] + xo[n],where
xe[n] = 1/2 {x[n]+x[-n]},xo[n] = 1/2 {x[n]-x[-n]}.
Symmetric Sequences
n
x[n]
0
n
x[n]
0
Example:x[n]=(3 6 2 10 1 8 5)x[-n]=(5 8 1 10 2 6 3)
xe[n]=(4 7 1.5 10 1.5 7 4)xo[n]=(-1 -1 0.5 0 0.5 1 1)
Created:June 1999
Last update:©AFMH DSP_L1_T16Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T16
• A complex sequence x[n] is said to be conjugate symmetric (see note below) if, for all n
» x[n] = x*[-n]
• whereas it is said to be conjugate antisymmetric if, for all n
» x[n] = -x*[-n]
Symmetric Sequences (Complex)
Note: A sequence that is conjugate symmetric is sometimes said to be hermitian. See Example 2.5 in Mitra for conjugate -symmetric sequence
Re
Im
Re
Im
See Example 2.5 in Mitra for conjugate -symmetric sequence
jba +
jba −
jba +jba +−
Created:June 1999
Last update:©AFMH DSP_L1_T17Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T17
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+N] for all n
• It follows that x[n+mN] = x[n] for all n and any integer m
• 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.
-N N0 n
x[n]
Sequence repeats itself every N samplesSee TP DSP_L1-T8
Sequence is also periodic with period 2N, period 3N, and all other integer multiples of N
Created:June 1999
Last update:©AFMH DSP_L1_T18Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T18
Exercises
Determine whether or not the following signals are periodic and, for each sequence that is periodic, determine the fundamental period.
)17/cos(][(d)
)2.0sin(][(c)}Im{}Re{][(b)
)125.0cos(][(a)
16
18/12/
π
π
π
π
ππ
nenx
nnxeenx
nnx
nj
jnjn
=
+=+=
=
Created:June 1999
Last update:©AFMH DSP_L1_T19Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T19
Solutions
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))
x[n] is periodic with fundamental period N0 = 16.
)125.0cos(][(a) nnx π=
168
22
00 === π
πωπN
Try plotting - adapt Matlab code on DSP_L1_T13
Created:June 1999
Last update:©AFMH DSP_L1_T20Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T20
Solutions
Here we have the sum of two periodic signals
)18/sin()12/cos(][
}Im{}Re{][(b) 18/12/
ππ
ππ
nnnx
eenx jnjn
+=
+=
),gcd( 21
21
NNNNN =
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
where gcd(N1, N2) means greatest common divisor of N1 and N2.
The same is true for x[n]=x1[n]x2[n]; however, the fundamental period may be smaller
72
36,2418/,12/
12)36)(24(
)36,24gcd()36)(24(
18/2
212/2
1
0201
===
====
==
N
NN ππ
ππ
πωπωTherefore, the period of the sum is
Created:June 1999
Last update:©AFMH DSP_L1_T21Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T21
Solutions
In order for this sequence to be periodic, we must be able to find a value for N such that
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.
))(2.0sin()2.0sin(
)2.0sin(][(c)
Nnn
nnx
++=+
+=
ππ
π
Created:June 1999
Last update:©AFMH DSP_L1_T22Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T22
Solutions
Here we have the product of two periodic signals,Therefore, the period of the sum is
)17/cos(][(d) 16 ππ
nenxnj
=
544
34,3217/,16/
2)34)(32(
)34,32gcd()34)(32(
17/2
216/2
1
0201
===
====
==
N
NN ππ
ππ
πωπω
Created:June 1999
Last update:©AFMH DSP_L1_T23Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T23
• 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)
• Time scaling– Given y[n]=x[Mn] or y[n]=x[n/N] where M
and N are positive integers.
Signal Manipulation:Shifting, Reversal, Time scaling
x[n]
n-2-1 0 1 2 3 4 5 6x[n-2]
n-2-1 0 1 2 3 4 5 6x[-n]
n-8-7 -6-5-4-3-2-10
x[2n]
n-2-1 0 1 2 3 4 5 6
Down-sampling by a factor of 2
x[n/2]
n-2 -1 0 1 2 3 4 5 6 7 8 9 10 11
Up-sampling by a factor of 2
Created:June 1999
Last update:©AFMH DSP_L1_T24Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T24
• 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.
• Scaling (or scalar multiplication)– Amplitude scaling by a constant c,
y[n] = cx[n] is accomplished by multiplying every sample value by c.
Signal Manipulation:Addition, Multiplication, Scaling
n -1 0 1 2 3 4
a[n] 2 -1 0 4 7 3
b[n] 3 5 -2 7 4 -5
Addition a[b]+b[n]
5 4 -2 11 11 8
Multiplicationa[n]b[n]
6 -5 0 28 28 -15
Scaling 3 a[n]
6 -3 0 12 21 9
Created:June 1999
Last update:©AFMH DSP_L1_T25Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T25
• The unit sequence may be used to decompose an arbitrary sequencex[n] into a sum of weighted and shifted unit samples as follows:
• This decomposition may be written concisely as:
Signal Manipulation:Shifting, Reversal, Time scaling
...)5(.1)4(.2)3(.3)2(.2)1(.1)(.0)1(.1......)2()2()1()1()()0()1()1(...)(
+−+−+−+−+−++++=+−+−+++−+=
nnnnnnnnxnxnxnxnx
δδδδδδδδδδδ
x[n]
n-1 0 1 2 3 4 5
∑∞
−∞=
−=k
knkxnx )()()( δ
↑
= ...)1232101(...][nx
Created:June 1999
Last update:©AFMH DSP_L1_T26Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T26
Exercises
Express the sequence
as a sum of scaled and shifted unit steps.
⎪⎪⎩
⎪⎪⎨
⎧
===
=
elsennn
nx
0231201
)(
Created:June 1999
Last update:©AFMH DSP_L1_T27Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T27
Solution
There are several ways to derive the signal decomposition.(a) Express as a sum of weighted and shifted unit samples
Use the fact:Therefore
(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).
)2(3)1(2)()( −+−+= nnnnx δδδ)1()()( −−= nununδ
)3(3)2()1()()]3()2([3)]2()1([2)1()()(
−−−+−+=−−−+−−−+−−=
nununununununununununx
Created:June 1999
Last update:©AFMH DSP_L1_T28Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T28
Application Example #1 -Signal Smoothing
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:
])1[][]1[(31][ +++−= nxnxnxny
0 5 10 15 20 25 30 35 40 45 50-2
0
2
4
6
8
Time index nAm
plitu
de
d[n]s[n]x[n]
0 5 10 15 20 25 30 35 40 45 500
2
4
6
8
Time index n
Ampl
itude
y[n]s[n]
% Signal Smoothing by Averagingclf;% 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 smoothingx1 = [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
Created:June 1999
Last update:©AFMH DSP_L1_T29Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T29
Application Example #2 -Amplitude Modulation
An amplitude modulated signal can be generated by modulating a high-frequency sinusoidal signal, with a low-frequency sinusoidal signal, . The resulting signal is of the form:
where m is the modulation index.
)cos(][ nnx HH ω=)cos(][ nnx LL ω=
)cos())cos(.1(][])[.1(][ nnmAnxnxmAny HLHL ωω+=+=
0 10 20 30 40 50 60 70 80 90 100-1.5
-1
-0.5
0
0.5
1
1.5
Time index n
Ampl
itude
% Generation of amplitude modulated seqclf;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');
Ref: Program P1_6, DSP Lab using Matlab, Mitra
Created:June 1999
Last update:©AFMH DSP_L1_T30Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T30
Application Example #2 -Amplitude Modulation
)cos())cos(.1(][])[.1(][ nnmAnxnxmAny HLHL ωω+=+=
0 10 20 30 40 50 60 70 80 90 100-1.5
-1
-0.5
0
0.5
1
1.5
Time index n
Ampl
itude
Created:June 1999
Last update:©AFMH DSP_L1_T31Created:June 1999
Last update:July 2010
Discrete-Time Signals: Review
©AFMH DSP_L1_T31
Application Example #3 -Swept Frequency Sinusoidal Sequence
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
% Generation of a swept freq sinusoidal seqn = 0:100; a = pi/2/400; b = 0;arg = a*n.*n + b*n;x = cos(arg);clf;stem(n, x);axis([0,100,-1.5,1.5]);title('Swept-Frequency Sinusoidal Signal');xlabel('Time index n'); ylabel('Amplitude');grid; axis;
0 10 20 30 40 50 60 70 80 90 100-1.5
-1
-0.5
0
0.5
1
1.5Swept-Frequency Sinusoidal Signal
Time index n
Ampl
itude
top related