dsp using matlab® - 6
TRANSCRIPT
Lecture 6: The Discrete-Time Fourier Analysis (DTFT)
Mr. Iskandar Yahya
Prof. Dr. Salina A. Samad
The discrete-time Fourier transform(DTFT)
If x(n) is absolutely sum able:
Then, discrete-time Fourier transform(DTFT):
Inverse discrete-time Fourier transform(IDTFT) of X(ejw):
)k(x
jwnjw e)n(x)]n(x[F)e(X
dwe)e(X)]e(X[F)n(x jwnjwjw
2
11
Two important properties1. Periodicity
The DTFT X(ejw) is periodic in w with period 2:
Implication: We need only one period of X(ejw) i.e. w[0,2], or [- , ], ect.
2. Symmetry For real-valued x(n), X(ejw) is conjugate symmetric X(ejw) = X*(ejw) or - Re[X(e-jw)] = Re[X(ejw)] (even symmetry)
- Im[X(e-jw)] = Im[X(ejw)] (odd symmetry) -|X(e-jw)| = |X(ejw)| (even symmetry) - phase(X(e-jw)) = phase(X(ejw)) (odd symmetry) Implication:
We need only half period of X(ejw) i.e. w[0,]
)e(X)e(X )w(jjw 2
The discrete-time Fourier transform(DTFT)
Example 1: Determine the DTFT of :
)n(u).()n(x n50
50501
150
500
.e
e
e.)e.(
e).(e)n(x)e(X
jw
jw
jwnjw
jwnnjwnjw
The discrete-time Fourier transform(DTFT)Matlab implementation for Example 1:
plot magnitude, angle, real, imaginary parts of ex 3.1 between [0, ]>> w = [0:1:500]*pi/500; % [0, pi] axis divided into 501
points from 0 to pi.X = exp(j*w) ./ (exp(j*w) - 0.5*ones(1,501));magX = abs(X); angX = angle(X);realX = real(X); imagX = imag(X);
>>subplot(2,2,1); plot(w/pi,magX); gridxlabel('frequency in pi units'); title('Magnitude Part'); ylabel('Magnitude')>> subplot(2,2,3); plot(w/pi,angX); gridxlabel('frequency in pi units'); title('Angle Part'); ylabel('Radians')>> subplot(2,2,2); plot(w/pi,realX); gridxlabel('frequency in pi units'); title('Real Part'); ylabel('Real')>> subplot(2,2,4); plot(w/pi,imagX); gridxlabel('frequency in pi units'); title('Imaginary Part'); ylabel('Imaginary')
The Discrete-Time Fourier Transform(DTFT)Matlab implementation for Example 1:
plot magnitude, angle, real, imaginary parts of ex 3.1 between [0, ]
0 0.2 0.4 0.6 0.8 10.6
0.8
1
1.2
1.4
1.6
1.8
2
frequency in pi units
Magnitude Part
Mag
nitu
de
0 0.2 0.4 0.6 0.8 1-0.7
-0.6
-0.5
-0.4
-0.3
-0.2
-0.1
0
frequency in pi units
Angle Part
Rad
ians
0 0.2 0.4 0.6 0.8 10.6
0.8
1
1.2
1.4
1.6
1.8
2
frequency in pi units
Real Part
Rea
l
0 0.2 0.4 0.6 0.8 1-0.7
-0.6
-0.5
-0.4
-0.3
-0.2
-0.1
0
frequency in pi units
Imaginary PartIm
agin
ary
The discrete-time Fourier transform(DTFT)
Example 2: Determine the DTFT of the following finite-duration sequence:
},,,,{)n(x 54321
wjwjjwjwjwnjw eeeee)n(x)e(X 32 5432
The discrete-time Fourier transform(DTFT)Matlab implementation for Example 2:
>> n = -1:3; x = [1,2,3,4,5]; % sequence x(n)k = 0:500; w = (pi/500)*k; % [0, pi] axis divided into 501 points.X = x * (exp(-j*pi/500)) .^ (n'*k); % DTFT using matrix-vector productmagX = abs(X); angX = angle(X);realX = real(X); imagX = imag(X);
subplot(2,2,1); plot(w/pi,magX); gridxlabel('frequency in pi units'); title('Magnitude Part'); ylabel('Magnitude')subplot(2,2,3); plot(w/pi,angX); gridxlabel('frequency in pi units'); title('Angle Part'); ylabel('Radians')subplot(2,2,2); plot(w/pi,realX); gridxlabel('frequency in pi units'); title('Real Part'); ylabel('Real')subplot(2,2,4); plot(w/pi,imagX); gridxlabel('frequency in pi units'); title('Imaginary Part'); ylabel('Imaginary')
The discrete-time Fourier transform(DTFT)Matlab implementation for Example 2:
0 0.2 0.4 0.6 0.8 12
4
6
8
10
12
14
16
frequency in pi units
Magnitude Part
Mag
nitu
de
0 0.2 0.4 0.6 0.8 1-4
-2
0
2
4
frequency in pi units
Angle Part
Rad
ians
0 0.2 0.4 0.6 0.8 1-5
0
5
10
15
frequency in pi units
Real Part
Rea
l
0 0.2 0.4 0.6 0.8 1-10
-8
-6
-4
-2
0
2
4
frequency in pi units
Imaginary Part
Imag
inar
y
The discrete-time Fourier transform(DTFT)Example 3:
Let, x(n) = (0.9ej/3)n, 0n10,Then, find X(ejw) ? Investigate its Periodicity?
>> n = 0:10; x = (0.9*exp(j*pi/3)).^n;k = -200:200; w = (pi/100)*k;X = x * (exp(-j*pi/100)) .^ (n'*k);magX = abs(X); angX =angle(X);subplot(2,1,1); plot(w/pi,magX);gridaxis([-2,2,0,8])xlabel('frequency in units of pi'); ylabel('|X|')title('Magnitude Part')>> subplot(2,1,2); plot(w/pi,angX/pi);gridaxis([-2,2,-1,1])xlabel('frequency in units of pi'); ylabel('radians/pi')title('Angle Part')
The discrete-time Fourier transform(DTFT)
From the plot, we observe that X(ejw) is periodic in ω but is not conjugate-symmetric.
-2 -1.5 -1 -0.5 0 0.5 1 1.5 20
2
4
6
8
frequency in units of pi
|X|
Magnitude Part
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2-1
-0.5
0
0.5
1
frequency in units of pi
radia
ns/p
i
Angle Part
The discrete-time Fourier transform(DTFT)Example 4:
Let, x(n) = (0.9)n, -5n5,Then, determine X(ejw) ? Investigate the Conjugate-
symmetry property?
>> n = -5:5; x = (-0.9).^n;k = -200:200; w = (pi/100)*k;X = x * (exp(-j*pi/100)) .^ (n'*k);magX = abs(X); angX =angle(X);subplot(2,1,1); plot(w/pi,magX);gridaxis([-2,2,0,15])xlabel('frequency in units of pi'); ylabel('|X|')title('Magnitude Part')subplot(2,1,2); plot(w/pi,angX/pi);gridaxis([-2,2,-1,1])xlabel('frequency in units of pi'); ylabel('radians/pi')title('Angle Part')
The discrete-time Fourier transform(DTFT)
From the plot above, we observe that X(ejw) is periodic in ω and also conjugate-symmetric.
-2 -1.5 -1 -0.5 0 0.5 1 1.5 20
5
10
15
frequency in units of pi
|X|
Magnitude Part
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2-1
-0.5
0
0.5
1
frequency in units of pi
rad
ian
s/p
i
Angle Part
The Properties of DTFTLet, X(ejw) be the discrete time Fourier Transform
of x(n), Then:1. Linearity
2. Time shifting
3. Frequency shifting
4. Conjugation
5. Folding
6. Symmetries in real sequences
)]n(x[F)]n(x[F)]n(x)n(x[F 2121
jwkjw e)e(X)]kn(x[F
)e(X]e)n(x[F )ww(jkjw 00
)e(X)]n(x[F jw**
)e(X)]n(x[F jw
)]e(XIm[j)]n(x[F
)]e(XRe[)]n(x[F)then
)n(x)n(x)n(x
jwo
jwe
oe
The Properties of DTFT
7. Convolution
8. Multiplication
Exercise: Verify the properties of DTFT using Matlab by using numerical (random sequences) or graphical approach (cosine/exponential sequences).
)e(X)e(X)]n(x[F)]n(x[F)]n(x*)n(x[F jwjw212121
d)e(X)e(X)]n(x[F)]n(x[F)]n(x)n(x[F jj212121 2
1
The LTI SystemsFrequency domain representation
Frequency Response The discrete-time Fourier transform of an impulse
response is call the Frequency Response (or Transfer Function) of an LTI system and is denoted by :
(eqn 1)
Then we can represent the system by:
(eqn 2)
The output sequence is the input exponential sequence modified by the response of the system at frequency ωo.
Note that we have the gain (magnitude) response and phase response functions.
The LTI SystemsExample 1: Determine the frequency response H(ejw) of a
system characterized by h(n) = (0.9)n u(n). Plot the magnitude and phase responses.
Solution: Use (eqn 1):
Hence
and
The LTI SystemsTo plot, we can implement both magnitude and phase
responses, or the frequency response then compute its magnitude and phase. The second approach is more practical with Matlab:
W = [0:1:500]*pi/500; % [0, pi] axis divided into 501 points.H = exp(j*W) ./ (exp(j*W) - 0.9*ones(1,501));magH = abs(H); angH = angle(H);subplot(2,1,1); plot(W/pi, magH); grid;xlabel('frequency in pi units'); ylabel('|H|');title('Magnitude response');subplot(2,1,2); plot(W/pi, angH/pi); grid;xlabel('frequency in pi units'); ylabel('Phase in pi radians');title('Phase Response');
The LTI SystemsThe plot:
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
2
4
6
8
10
12
frequency in pi units
|H|
Magnitude response
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-0.4
-0.3
-0.2
-0.1
0
frequency in pi units
Ph
ase
in p
i ra
dia
ns
Phase Response
The LTI SystemsExample 2: An LTI system is specified by the difference
equation:
a) Determine H(ejw).b) Calculate and plot the steady-state response yss(n) to:
Solution:Rewrite as y(n) – 0.8y(n-1) = x(n)a) Use (eqn 2):
The LTI SystemsSolution:
b) In the steady state the input is x(n) = cos(0.05πn) with frequency wo = 0.05π and θ0 = Oo. The response of the system is:
Therefore,
This means that at the output the sinusoidal is scaled by 4.0928 and shifted by 3.42 samples. This can be verified using matlab (plot).
The LTI SystemsMatlab implementation:
subplot(1,1,1)b = 1; a = [1,-0.8];n=[0:100]; x = cos(0.05*pi*n);y = filter(b,a,x);subplot(2,1,1); stem(n,x);xlabel('n'); ylabel('x(n)'); title('Input Sequence')subplot(2,1,2); stem(n,y);xlabel('n'); ylabel('y(n)'); title('Output sequence')
The LTI SystemsMatlab implementation (PLOT):
0 10 20 30 40 50 60 70 80 90 100-1
-0.5
0
0.5
1
n
x(n
)
Input Sequence
0 10 20 30 40 50 60 70 80 90 100-5
0
5
n
y(n
)
Output sequence
3.42
4.092