DSP Lect L1
DSP Lect L1
Discrete-Time
Signals: Review Discrete-Time Signals
1
Discrete-Time
Signals: Review Generating a D-T Signal or Sequence
Discrete-Time
Signals: Review Complex Sequences
z[n] = (..., a + jb, c + jd ,...)
• 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]} z = a + jb
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: b z[n]
tan-1 b/a
|z[n]|2 = Re2{z[n]} + Im 2{z[n]}
• The phase may be found using a Re
arg{z[n]} = tan -1[Im{z[n]}/Re{z[n]}] -b
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: Last update: DSP_L1_T4
June 1999 July 2003
2
Discrete-Time Fundamental Sequences:
Signals: Review Unit Impulse Sequence δ [n]
• The unit impulse (or unit sample) sequence
δ [n], is defined as
δ[n]
1 n = 0 1
δ [ n] =
0 n ≠ 0
-2 -1 0 1 2 3 n
• The delayed/shifted unit impulse/sample
sequence δ[n-k] is defined by
δ[n-k]
1 n = k
δ [n − k ] =
0 n ≠ k
1
...
-2 -1 0 1 2 k n
1 n ≥ 0 u[n]
u[ n ] = 1
0 n < 0 ...
• Value of u[n] at n=0 is defined and equals
-2 -1 0 1 2 3 4 5 n
to unity (unlike c-t step function, u(t)).
1 n ≥ k 1
u[ n − k ] = ...
0 n < k
-2 -1 0 1 2 k n
AFMH Created: Last update: DSP_L1_T6
June 1999 July 2003
3
Discrete-Time Fundamental Sequences:
Signals: Review Unit Impulse Sequence
• From the definitions of
δ[n] and δ[n-k], it is x [ n ]δ [ n ] = x [ 0 ]δ [ n ]
readily seen that x [ n ]δ [ n − k ] = x [ k ]δ [ n − k ]
n
• Note that δ[n] and u[n]
are related by
u[n] = ∑ δ [ k ],
k = −∞
δ [ n ] = u [ n ] − u [ n − 1]
• Any sequence x[n] can
∞
be expressed as
(see DSP_L1_T24) x[ n ] = ∑ x [ k ]δ [ n − k ]
k = −∞
4
Discrete-Time Fundamental Sequences:
Signals: Review Complex-valued Exponential Sequences
Amplitude
c = -(1/12)+(pi/6)*i; 0
K = 2; -1
n = 0:40; -2
x = K*exp(c*n); 0 5 10 15 20
Time index n
25 30 35 40
subplot(2,1,1);
2e −12 n sin 212πn
1
stem(n,real(x)); 2
Imaginary part
Amplitude
1
subplot(2,1,2);
0
stem(n,imag(x));
xlabel('Time index n');ylabel('Amplitude'); -1
title('Imaginary part'); 0 5 10 15 20 25 30 35 40
Time index n
Ref: Program P1_2, DSP Lab using Matlab, Mitra AFMH Created: Last update: DSP_L1_T9
June 1999 July 2003
subplot(2,2,4); 0.6
0
stem(n, angle(x)*(180/pi)) 0.4
-100
% phase in degrees 0.2
0 -200
0 10 20 30 40 0 10 20 30 40
5
Discrete-Time Fundamental Sequences:
Signals: Review 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);
120 xlabel('Time index n');ylabel('Amplitude');
100
80
Amplitude
60
40
20
0
0 5 10 15 20 25 30 35
Time index n
Ref: Program P1_3, DSP Lab using Matlab, Mitra AFMH Created: Last update: DSP_L1_T11
June 1999 July 2003
x[n] = A cos(ω 0 n + θ )
If n is dimensionless, then both ω0 and θ have units of radians.
x[n]=cos(πn/6)
-6 6
-12 -9 -3 0 3 9 12 n
6
Discrete-Time Fundamental Sequences:
Signals: Review Sinusoidal Sequences
A = 1.5; 1
arg = 2*pi*f*n - phase;
0.5
x = A*cos(arg);
Amplitude
clf; % Clear old graph 0
Ref: Program P1_4, DSP Lab using Matlab, Mitra AFMH Created: Last update: DSP_L1_T13
June 1999 July 2003
Discrete-Time
Signals: Review Symmetric Sequences
7
Discrete-Time
Signals: Review Symmetric Sequences (Complex)
Discrete-Time
Signals: Review Periodic and Aperiodic Sequences
8
Discrete-Time
Signals: Review Exercises
Discrete-Time
Signals: Review Solutions
Ê (a) x[ n] = cos(0.125πn)
Because 0.125π = π/8,
9
Discrete-Time
Signals: Review Solutions
jn π / 12 jn π / 18
Ê (b) x[n ] = Re{e } + Im{e }
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
N1 N 2
N= 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
Discrete-Time
Signals: Review Solutions
10
Discrete-Time
Signals: Review Solutions
π
j n
Ê (d) x[n ] = e 16 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/π16 = 32, N 2 = π2/π17 = 34
N = gcd( 32 ,34 ) = =
( 32 )(34 ) (32 )(34 )
2
544
• Reversal -2-1 0 1 2 3 4 5 6 n
– Given y[n]=x[-n] (simply involves “flipping”
x[-n]
the sequence x[n] w.r.t. to index n)
-2-1 0 1 2 3 4 5 6 n -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 n
AFMH Created: Last update: DSP_L1_T22
June 1999 July 2003
11
Discrete-Time Signal Manipulation:
Signals: Review Addition, Multiplication, Scaling
• Addition
– The sum of 2 sequences,
y[n]=a[n]+b[n] is formed by the n -1 0 1 2 3 4
pointwise addition of the two
sequences.
a[n] 2 -1 0 4 7 3
x[n]
-2 -1 0 1 2 3 4 5 6 7 8 9 10 11 n
12
Discrete-Time
Signals: Review Exercises
Discrete-Time
Signals: Review Solution
13
Discrete-Time Application Example #1 -
Signals: Review 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:
% Signal Smoothing by Averaging 1
clf;
y[n] = ( x[ n − 1] + x[ n] + x[n + 1])
3
% Generate random noise, d[n]
R = 51; d = 0.8*(rand(R,1) - 0.5); 8
d[n]
% Generate uncorrupted signal, s[n] 6
s[n]
Amplitude
x[n]
m = 0:R-1; s = 2*m.*(0.9.^m); 4
0
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n); -0.5
y = (1+m*xL).*xH;
stem(n,y);grid; -1
xlabel('Time index n');ylabel('Amplitude');
-1.5
0 10 20 30 40 50 60 70 80 90 100
Time index n
Ref: Program P1_6, DSP Lab using Matlab, Mitra AFMH Created: Last update: DSP_L1_T28
June 1999 July 2003
14
Discrete-Time Application Example #2 -
Signals: Review Amplitude Modulation
0.5
Amplitude
-0.5
-1
-1.5
0 10 20 30 40 50 60 70 80 90 100
Time index n
n = 0:100; a = pi/2/400; b = 0;
arg = a*n.*n + b*n; 1
x = cos(arg);
0.5
clf;
Amplitude
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;
-1.5
0 10 20 30 40 50 60 70 80 90 100
Time index n
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: Last update: DSP_L1_T30
June 1999 July 2003
15