Post on 29-Dec-2015
Chapter 4
The Frequency Domain of Signals and Systems
Objectives• Define the Fourier transform and explain some of its important properties.• Define the discrete-time Fourier transform (DTFT) and demonstrate that it gives its
maximum response at the digital frequencies contained in a discrete time-domain signal.
• Prove the three key properties of the DTFT: linearity, periodicity, and time-delay.• Demonstrate the replication of the frequency content of a signal at integer multiples
of the sampling frequency• Demonstrate the concept of signal windowing in spectral analysis and show how
different windows affect the resolution and side-lobe amplitudes of the DTFT.• Explain the limitations of the DTFT and the “uncertainty principle” in spectral analysis.• Define signal power and energy and demonstrate their methods of calculation in the
time domain and frequency domain.• Show how to simulate signals with random noise and demonstrate the spectral
properties of Gaussian noise power in discrete-time signals.• Derive the frequency response of a general linear time-invariant DSP system and
show that the frequency response is the value of the z-domain transfer function on the unit circle in the complex plane.
Fourier’s Theorem
Fourier’s theorem states that any continuous periodic signal can be represented by an infinite sum of harmonically related sinusoids.
00 0
1
00
00
0 0 0
( ) cos( ) sin( 2
2( )cos( )
2( )sin( )
2 2= ( )cos(0) ( )
n nn
T
n
T
n
T T
as t a n t b n t
a s t n t dtT
b s t n t dtT
a s t dt s t dtT T
0( ) jn tn
n
s t c e
0
0
1( )
T jnnc s t e dtT
The coefficients (a,b,c) represent the frequency content of the signal at discrete frequencies.
The Fourier Coefficients of a Square Pulse Train
w/2-w/2
2pT pTpT
2pT
1
t
The Fourier Coefficients of a Square Pulse Train
( )
0
0 0
0 0
0 0
/ 2ω
/ 2
/ 2/ 2
ω 2
/ 20 / 2
π π
0
π π
0
1( )
1 1 1
ω
1 1
2π
1 1
π 2
1
Tjn t
nT
ww
jn t jn f t
wp p w
jn f w jn f w
p
jn f w jn f w
p
p
c s t e dtT
e dt eT T jn
e eT jn f
e e
T n f j
T
p
-
-
- -
--
-
-
=
é ù-ê ú= = ê úë û
é ù-ê ú= -ê úë û
æ öæ öæ ö-÷ç ÷ ÷ç ç÷ ÷ç ÷= ç ç÷ ÷ ÷ç ç ç÷ ÷÷çç÷ç è øè øè ø
æ=
ò
ò
0 0
0 0
0
sin( π ) sin( π )
π π
( π ) for < <
p
p
n f w n f ww
n f T n f w
wsinc n f w n
T
ö æ ö÷ ÷ç ç÷ ÷ç ç=÷ ÷ç ç÷ ÷÷ ÷ç çè ø è ø
æ ö÷ç ÷ç= - ¥ ¥÷ç ÷÷çè ø
Computational Analysis of a Square Pulse Train
(Custom M-file “pulse_train”) >> w=1; %Set the pulse width in ms>> fmax=3500; %Set the maximum harmonic frequency>> R1=4; %Set the period-to-width ratio for each case>> R2=8;>> R3=32;>> [c1,f1]=pulse_train(fmax,w,R1); %Use the M-file to compute the
Fourier coefficients>> [c2,f2]=pulse_train(fmax,w,R2); % Case 2>> [c3,f3]=pulse_train(fmax,w,R3); % Case 3
>> subplot(3,1,1),stem(f1,c1),title('Period to Width Ratio = 4');
>> subplot(3,1,2),stem(f2,c2),title('Period to Width Ratio = 8');
>> subplot(3,1,3),stem(f3,c3),title('Period to Width Ratio = 32');
>> xlabel('Harmonic Frequency - Hz')
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000-0.5
0
0.5Period to Width Ratio = 4
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000-0.2
0
0.2Period to Width Ratio = 8
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000-0.05
0
0.05Period to Width Ratio = 32
Harmonic Frequency - Hz
As the period-to-width ratio increases the frequency “density” of the coefficients increases. In the limit, the coefficients become a continuous function of frequency.
Fourier Transform
• The pulse train analysis suggests that for a general non-periodic signal, a continuous function of frequency represents the “frequency content” of the continuous signal.
• Definition of the Fourier transform:
ω(ω) ( ) ¥
-
- ¥=ò j tX x t e dt
ω{ ( )} ( ) ¥
-
- ¥=ò j tx t x t e dtF
The Discrete-Time Fourier Transform (DTFT)
• The DTFT is the Fourier transform for discrete-time signals• The DTFT requires a finite causal signal for a practical
calculation. Therefore, the result depends on signal length, N• The DTFT is a continuous complex function of Ω• Calculation of the DTFT requires N terms for a discrete Ω.
Thus, practical calculations require computer assistance.• Efficient computation of the DTFT is an important problem in
DSP (e.g., the FFT or “Fast Fourier Transform”)
1
0
( ) [ ] [ ] N
j n j n
n n
X x n e x n e
2 s
f
f
Example Calculation
Calculate the DTFT for the signal x[n] = [1,-1,1,-1] at the digital frequencies of π and π/2.
For Ω = π:
For Ω = π/2
1 3 3 3
0 0 0 0
( ) [ ] [ ] [ ] cos( ) sin( ) [ ]cos( )
(1)(1) ( 1)( 1) (1)(1) ( 1)( 1)
4
Nj n j n
n n n n
X x n e x n e x n n j n x n n
1 3 3/ 2
0 0 0
( ) [ ] [ ] [ ] cos( ) sin( )2 2
3 3(1)[cos(0) sin(0)] ( 1)[cos( ) sin( )] (1)[cos( ) sin( )] ( 1)[cos sin( )]
2 2 2 2(1)(1) ( 1)( ) (1)( 1) ( 1)( )
0
Nj n j n
n n n
X x n e x n e x n n j n
j j j j
j j
Example Calculation:A Short Sinusoid at 3 Frequencies
>> n=0:7;>> omega1=pi/2;>> x=cos(omega1*n);>> stem(n,x), title('8 Samples of a Sinusoid of Frequency pi/2')>> xlabel('Index, n')>> omega=[0,pi/2,pi]; % Our three values of Ω>> X=[0,0,0]; % We initialize the vector for X>> for k=1:3 % For each value of omega>> for m=1:8 % For each value of the signal% Compute the DTFT summation for the kth value of Ω>> X(k)=X(k)+x(m)*exp(-j*omega(k)*(m-1)); >> end>> end>> figure,plot(omega/pi,abs(X))>> title('Three Points of the DTFT')>> ylabel('Magnitude of the DTFT')>> xlabel('Digital Frequency in Units of Pi')
Example Calculation:A Short Sinusoid at 3 Frequencies
0 1 2 3 4 5 6 7-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
18 Samples of a Sinusoid of Frequency pi/2
Index, n0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.5
1
1.5
2
2.5
3
3.5
4Three Points of the DTFT
Mag
nitu
de o
f th
e D
TF
TDigital Frequency in Units of Pi
Example Calculation:A Short Sinusoid at 512 Frequencies
• >> dtft_demo(x,0,pi,512); % Custom M-file
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1
1.5
2
2.5
3
3.5
4Discrete Time Fourier Transform
Units of Pi
Example Calculation:A Long Sinusoid at 512 Frequencies
>> n=0:99; % create a signal with 100 samples
>> omega1=pi/2;
>> x=cos(omega1*n);
>> dtft_demo(x,0,pi,512);title('DTFT of a Sinusoid, Omega = pi/2, N = 100')
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
5
10
15
20
25
30
35
40
45
50DTFT of a Sinusoid, Omega = pi/2, N = 100
Units of Pi
Properties of the DTFTLinearity
• Suppose y[n] = x1[n] + x2[n]
1 2
1 2
1 2
( ) [ ] [ ] [ ]
[ ] [ ]
( ) ( )
j n j n
n n
j n j n
n n
Y y n e x n x n e
x n e x n e
X X
The DTFT of a linear combination of signals is the same linear combination of the DTFT’s of the individual signals.
Properties of the DTFTPeriodicity
( ) [ ] j n
n
X x n e
( 2 )
2
2
( 2 ) [ ]
[ ]
cos(2 ) sin(2 ) 1
( 2 ) [ ] ( )
j k n
n
j n j kn
n
j kn
j n
n
X k x n e
x n e e
but
e kn j kn
so
X k x n e X
The DTFT is periodic in the Ω frequency domain with period 2π
Properties of the DTFTTime-Delay
Suppose the DTFT of x[n] is X(Ω) and the DTFT of x[n-k] is Xk(Ω)
( )
( ) [ ]
:
,
( ) [ ]
[ ] ( )
j nk
n
j m kk
m k
jm jk jk
m
X x n k e
let
m n k
n m k
then
X x m e
x m e e e X
The DTFT of a signal delayed by k steps is e -jkΩ times the DTFT of the un-delayed signal
Replication of Spectral Content in the Frequency Domain (Periodicity of the DTFT)
>> [asig,tt]=analog([50,120],[1,0.5],500,32000);
>> d1000=sample(tt,asig,1000);
>> d2000=sample(tt,asig,2000);
>> dtft_demof(d1000,-500,500,512,1000);
>> figure,subplot(2,1,1), dtft_demof(d1000,0,8000,16*512,1000); title('Fs = 1000 Hz')
>> subplot(2,1,2), dtft_demof(d2000,0,8000,16*512,2000); title('Fs = 2000 Hz')
-500 -400 -300 -200 -100 0 100 200 300 400 5000
50
100
150
200
250Discrete Time Fourier Transform
Hz
0 1000 2000 3000 4000 5000 6000 7000 80000
100
200
300Fs = 1000 Hz
Hz
0 1000 2000 3000 4000 5000 6000 7000 80000
200
400
600Fs = 2000 Hz
Hz
Replication at integer multiples of the sampling frequency
Effects of Signal Length and WindowingFrequency Resolution
>> N1=0:9;>> N2=0:19;>> N3=0:39;>> omega=pi/2;>> x1=cos(omega*N1);>> x2=cos(omega*N2);>> x3=cos(omega*N3);>> [X1,f]=dtft_demo(x1,0,pi,512);>> [X2,f]=dtft_demo(x2,0,pi,512);>> [X3,f]=dtft_demo(x3,0,pi,512);
>> subplot(3,1,1),plot(f/pi,(abs(X1)/max(abs(X1)))),title('DTFT - N=10')
>> subplot(3,1,2),plot(f/pi,(abs(X2)/max(abs(X2)))),title('DTFT - N=20')
>> subplot(3,1,3),plot(f/pi,(abs(X3)/max(abs(X3)))),title('DTFT - N=40')
>> xlabel('X Axis - Frequency in Units of Pi')
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT - N=10
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT - N=20
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT - N=40
X Axis - Frequency in Units of Pi
Each doubling of the signal length reduces the main lobe width by half
4
N
Effects of Signal Length and WindowingGibbs Phenomenon
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT - N=10
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT - N=20
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT - N=40
X Axis - Frequency in Units of Pi
In all cases, the rectangular window (abrupt truncation of the signal) results in side lobes (Gibbs phenomenon)
Effects of Signal Length and WindowingTapering Window: The Time Domain
>> x=analog(100,1,100,4000); % 100 Hz sinusoid, 100 ms long, Fs=4kHz>> xw=x.*hamming(length(x))'; % The Hamming window is given by “hamming”>> subplot(3,1,1),plot(x),title('Rectangular Windowed Sinusoid, N=401')>> subplot(3,1,2),plot(hamming(length(x))),title('Hamming Window, N=401')>> subplot(3,1,3),plot(xw),title('Hamming Windowed Sinusoid, N=401')>> xlabel('X Axis - Sample Index')
0 50 100 150 200 250 300 350 400 450-1
0
1Rectangular Windowed Sinusoid, N=401
0 50 100 150 200 250 300 350 400 4500
0.5
1Hamming Window, N=401
0 50 100 150 200 250 300 350 400 450-1
0
1Hamming Windowed Sinusoid, N=401
X Axis - Sample Index
The window function (Hamming) tapers the abrupt truncation of the signal but preserves its frequency characteristics
Effects of Signal Length and WindowingTapering Window: The Frequency Domain
>> N=0:39;>> omega=pi/2;>> x=cos(omega*N);>> xw=x.*hamming(length(x))';>> [X,f]=dtft_demo(x,0,pi,512);>> [XW,f]=dtft_demo(xw,0,pi,512);
>> subplot(2,1,1),plot(f/pi,abs(X)/max(abs(X)));>> title('DTFT of Rectangular Windowed Signal, N=40');>> subplot(2,1,2),plot(f/pi,abs(XW)/max(abs(XW)));>> title('DTFT of Hamming Windowed Signal, N=40');>> xlabel('X Axis - Frequency in Units of Pi')
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.2
0.4
0.6
0.8
1DTFT of Rectangular Windowed Signal, N=40
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.5
1DTFT of Hamming Windowed Signal, N=40
X Axis - Frequency in Units of Pi
The Hamming window suppresses the side lobes but degrades the resolution of the main lobe
4
2
r
Nr
Effects of Signal Length and WindowingHamming and Blackman Tapering Windows
>> xb=x.*blackman(length(x))';>> [XB,f]=dtft_demo(xb,0,pi,512);>> subplot(2,1,1),plot(f/pi,20*log10(abs(XW)/max(abs(XW))))>> title('Hamming Window')>> axis([0,1,-100,0])>> subplot(2,1,2),plot(f/pi,20*log10(abs(XB)/max(abs(XB))))>> title('Blackman Window')
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100
-50
0Hamming Window
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100
-50
0Blackman Window
1. The Blackman window suppresses side lobes further, but…
2. The Blackman window degrades resolution to a greater extent, r = 2.6
Effects of Signal Length and WindowingComparison of Windows
>> subplot(3,1,1),plot(f/pi,20*log10(abs(X)/max(abs(X))))>> axis([0,1,-100,0])>> subplot(3,1,2),plot(f/pi,20*log10(abs(XW)/max(abs(XW))))>> axis([0,1,-100,0])>> subplot(3,1,3),plot(f/pi,20*log10(abs(XB)/max(abs(XB))))
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100
-50
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100
-50
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100
-50
0
Rectangular Window
Hamming Window
Blackman Window
Spectral Analysis
( ) sin(2 2000 ) .0032sin(2 2500 ) sin(2 3000 ) s t t t t
2 2 4
2
s s
s
f rf
f f N
or
rff
N
Problem: What is the minimum number of samples required to resolve the spectral components of the signal s(t)? Assume a sampling frequency of 10 kHz.
The spectral components are separated by 500 Hz and the 2500 Hz component is -50 dB below the other two components. Pick 300 Hz as the desired resolution. A Blackman window would be required to suppress the side lobes more than 50 dB
2 (2)(2.6)(10000)173
300srfNf
Spectral AnalysisThe Importance of Correct Windowing
>> x=analog([2000 2500 3000],[1 .0032 1],17.3,10000);>> xh=x.*hamming(length(x))'; % Window the signal
with a Hamming window>> xb=x.*blackman(length(x))'; % Window the signal
with a Blackman window>> [Xh,f]=dtft_demof(xh,0,5000,512,10000); % DTFT of
the Hamming signal>> [Xb,f]=dtft_demof(xb,0,5000,512,10000); % DTFT of
the Blackman signal
>> subplot(2,1,1),plot(f,20*log10(abs(Xh)/max(abs(Xh)))), axis([0 5000 -80 0])
>> title('DTFT - Hamming Window')>> subplot(2,1,2),plot(f,20*log10(abs(Xb)/max(abs(Xb)))),
axis([0 5000 -80 0])>> title('DTFT - Blackman Window')>> xlabel('Hz')
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000-80
-60
-40
-20
0DTFT - Hamming Window
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000-80
-60
-40
-20
0DTFT - Blackman Window
Hz
The Hamming window does not suppress the side lobes sufficiently to resolve the weak component at the correct relative amplitude (-50 dB)
The signal length is 173
The Discrete Fourier Transform (DFT)
• The DFT is a discrete transform X[k] of a digital signal rather than a continuous transform like X(Ω)
• The length of the DFT is equal to the length of the signal• The DFT is defined always over the interval Ω = [0,2π]• The DFT turns out to be a sample of the DTFT of x[n] over the
interval [0,2π].
1 2
0
[ ] [ ]
0,1,2,... 1
kN j nN
n
X k x n e
k N
The Discrete Fourier Transform (DFT)
>> n1=0:10;>> n2=0:40;>> f=pi/4;>> y1=cos(f*n1);>> y2=cos(f*n2);>> subplot(2,1,1),stem(n1,y1);title('Short Signal,
y1'),xlabel('Sample')>> subplot(2,1,2),stem(n2,y2);title('Long Signal,
y2'),xlabel('Sample')
>> [X1,omega1]=dft_demo(y1);>> [X2,omega2]=dft_demo(y2);>> subplot(2,1,1),stem(omega1/pi,abs(X1));title('DFT of y1')>> subplot(2,1,2),stem(omega2/pi,abs(X2));title('DFT of y2')>> xlabel('X axis: Digital Frequency in of pi')
0 1 2 3 4 5 6 7 8 9 10-1
-0.5
0
0.5
1Short Signal, y1
Sample
0 5 10 15 20 25 30 35 40-1
-0.5
0
0.5
1Long Signal, y2
Sample
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20
2
4
6DFT of y1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20
10
20
30DFT of y2
The Discrete Fourier Transform (DFT)
>> [X1_dtft,omega_dtft]=dtft_demo(y1,0,2*pi,512);
>> plot(omega_dtft/pi,abs(X1_dtft))
>> hold
>> stem(omega1/pi,abs(X1), 'k')
>> legend('DTFT of x1','DFT of x1')
>> title('Comparison of DTFT and DFT for Signal x1')
>> hold off
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20
1
2
3
4
5
6Comparison of DTFT and DFT for Signal x1
DTFT of x1
DFT of x1
The DFT of a signal is a sample of the DTFT in the interval [0,2π]
Inverse Transforms
2
1[ ] ( )
2where
( ) [ ]
jn
j n
n
x n X e d
X x n e
1 2
0
1 2
0
1[ ] [ ]
0,1,... 1
where
[ ] [ ]
kN j nN
k
kN j nN
n
x n X k eN
n N
X k x n e
Inverse DTFT
Inverse DFT
Energy and Power in Signals
• Analog signals physically transport energy between two points to do useful work (for example, from an amplifier to a speaker).
• Digital signals carry information but not physical energy (digital signals are simply numbers that represent analog signals).
• We seek something that mathematically represents energy and power (rate of change of energy) for digital signals that is computable from their numerical values.
Power and Energy in Analog Signals
For a sinusoidal voltage with amplitude A, the power dissipated in the impedance is
2 2 1
2rmsV A
PR R
That is, the power is proportional to mean square of the voltage. The energy consumed is the power X time,
Power and Energy in Digital Signals
• By analogy with an analog signal, we can define the power in a digital signal to be the mean square of the signal values.
• Since the number of samples, N, defines a time window (t = NTs), we can define the energy in a digital signal to be:
12
0
1| [ ] |
N
n
P x nN
12
0
| [ ] | N
n
E x n
Parseval’s Theorem
• Physical signals must obey the conservation of energy. A signal in the time domain must have the same power as the signal in the frequency domain.
• Digital signals must also have the same power in the two domains. Using the inverse DTFT, it can be shown that:
• In the above equation, the LHS is the time domain, while the RHS is the frequency domain. This result is called Parseval’s Theorem
1 12 * 2
0 0
1 1 1| [ ] | [ ] [ ] | ( ) |
2
N N
Nn n
P x n x n x n X dN N N
Energy Conservation in Signals
• Parseval’s Theorem states that a digital signal must have the same power in both the time (sample) domain and the frequency domain
• Energy conservation also implies that digital signal power cannot depend on the sampling frequency (fs)
Example Power Calculations
• Compute the power in the signal:
• The power in the analog signal is
22/2+12/2 +.52/2=2.625• Compute the power in the digital signal:
– At two different sampling frequencies (1 kHz, 2kHz)– In the time domain (mean square of the signal values)– In the frequency domain (integration of the DTFT using the
custom M-file sig_power)
( ) 2sin(2 100 ) sin(2 200 ) 0.5sin(2 300 )s t t t t
Example Power Calculations
% Construct a pseudo-analog signal and sample at two different Fs:>> [s,t]=analog([100,200,300],[2,1,.5],1000,50000);>> d1000=sample(t,s,1000);>> d2000=sample(t,s,2000);% Compute the time domain power:>> [mean(d1000.^2),mean(d2000.^2)] ans =
2.6224 2.6237 (Total Power does not depend on Fs)% Compute the frequency domain power:>> [sig_power(d1000),sig_power(d2000)]ans = 2.6224 2.6237 (Frequency domain power = time domain power)
Gaussian Noise
• Random electrical noise from the environment and thermal noise from components can contaminate analog voltage signals.
• The noise usually has a “normal” or “Gaussian” statistical distribution
• In MATLAB, Gaussian noise can be simulated with the “randn” random number generator.
Normal Distribution of “randn”% Create a randn vector with 1000 values:>> N=1:1000;>> rn=randn(size(N));% Compute a histogram of randn values with 11 bins from -3 to 3:>> xr=-3:6/10:3;>> M=hist(rn,xr);% Plot a “normalized”(area = 1) histogram of the randn values:>> bar(xr,M/(.6*sum(M)))% Compute the normal pdf of mean 0 and variance 1 from -3 to 3:>> xn=-3:.01:3;>> y=pdf('normal',xn,0,1);% Plot the pdf on the histogram plot:>> hold
>> plot(xn,y,'r','LineWidth',2)>> hold off>> legend('Normalized histogram of randn values','The normal distribution')
Normal Distribution of “randn”
-4 -3 -2 -1 0 1 2 3 40
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45Normalized histogram of randn values
The normal distribution
Noise Signals>> N1=1:1000;>> N2=1:2000;>> t1=N1; % Define each signal to be 1000 milliseconds
long>> t2=N2/2;>> n1=randn(size(N1)); % n1 is 1000 samples, 1 ms per
sample>> n2=randn(size(N2)); % n2 is 2000 samples, 0.5 ms
per sample
>> subplot(2,1,1),plot(t1,n1),title('Gaussian Noise Signal Sampled at 1 kHz')
>> axis([0 1000 -4 4])>> subplot(2,1,2),plot(t2,n2),title('Gaussian Noise Signal
Sampled at 2 kHz')>> axis([0 1000 -4 4])>> xlabel('X axis - time in milliseconds')
0 100 200 300 400 500 600 700 800 900 1000-4
-2
0
2
4Gaussian Noise Signal Sampled at 1 kHz
0 100 200 300 400 500 600 700 800 900 1000-4
-2
0
2
4Gaussian Noise Signal Sampled at 2 kHz
X axis - time in milliseconds
The amplitude of the randn noise signal is, with high probability, between -3 and 3 because it has mean zero and standard deviation 1
Frequency Domain of Gaussian Noise
>> [X1,f1]=dtft_demof(n1,0,1000,1024,1000);
>> [X2,f2]=dtft_demof(n2,0,2000,1024,2000);
>> subplot(2,1,1),plot(f1,abs(X1)),title('DTFT of n1, Fs = 1 kHz')
>> subplot(2,1,2),plot(f2,abs(X2)),title('DTFT of n2, Fs = 2 kHz')
>> xlabel('X Axis - Frequency in Hz')
0 100 200 300 400 500 600 700 800 900 10000
50
100DTFT of n1, Fs = 1 kHz
0 200 400 600 800 1000 1200 1400 1600 1800 20000
50
100
150DTFT of n2, Fs = 2 kHz
X Axis - Frequency in Hz
For both sampling frequencies, the noise power is uniformly distributed in the frequency domain
Noise Power Density in the Frequency Domain
π2
π
1| ( ) |
2π
2π
-
= W W
W=
ò N
s
P X dN
d dff
/ 2 for p= W=sf f
/ 2
2
/ 2
1 2π| ( ) |
2π-
æ öæ ö ÷ç÷ç ÷= ç÷ç ÷÷çç ÷çè øè øòs
s
f
Ns f
P X f dfN f
/ 2 2
/ 2
| ( ) |
-
= òs
s
f
sf
X fP df
Nf
2| ( ) |( )=
s
X fp f
Nf
Noise power density is inversely proportional to the sampling frequency
Power Density and Sampling Frequency
>> p1=(abs(X1)).^2/(1000*length(n1)); % The power density of signal n1
>> p2=(abs(X2)).^2/(2000*length(n2)); % The power density of signal n2
>> subplot(2,1,1),plot(f1,p1),title('Power Density of n1, Fs = 1 kHz')
>> axis([0 1000 0 6e-3])
>> subplot(2,1,2),plot(f2,p2),title('Power Density of n2, Fs = 2 kHz')
>> axis([0 2000 0 6e-3])
>> xlabel('X Axis - Frequency in Hz')
>> mean(p2) % The average of the power density of signal n2
>> mean(p1) % The average of the power density of signal n1
ans =
5.0565e-004
ans =
8.9208e-004
0 100 200 300 400 500 600 700 800 900 10000
2
4
6x 10
-3 Power Density of n1, Fs = 1 kHz
0 200 400 600 800 1000 1200 1400 1600 1800 20000
2
4
6x 10
-3 Power Density of n2, Fs = 2 kHz
X Axis - Frequency in Hz
Frequency Response
The frequency response of a general LTI system can be derived by taking the DTFT of the difference equation, using the linearity and time-delay properties.
0 0
[ ] [ ]= =
- = -å åN M
k kk k
a y n k b x n k
20 1 2
20 1 2
0
0
( )( )
( )
( )
j j jMM
j j jNN
Mjk
kkN
jkk
k
b b e b e b eYH
X a a e a e a e
b eH
a e
- W - W - W
- W - W - W
- W
=
- W
=
+ + + +WW= =
W + + + +
W=å
å
H(Ω) is the value of the transfer function H(z) on the unit circle z = e jΩ
Filter Shape and Symmetry>> omega=-pi:2*pi/100:pi; % a vector of 100 values from –pi to pi>> z=exp(j*omega); % the complex number on the unit circle from –pi to pi>> H=(.0959-0.1917*z.^-2+0.0959*z.^-4)./(1+0.9539*z.^-2+0.3373*z.^-4);>> plot(omega/pi,abs(H))>> title('Example of Filter Shape and Symmetry')>> xlabel('Digital Frequency in Units of Pi')>> ylabel('Magnitude of the Filter Frequency Response')
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
1.2
1.4Example of Filter Shape and Symmetry
Digital Frequency in Units of Pi
Mag
nitu
de o
f th
e F
ilter
Fre
quen
cy R
espo
nse
2 4
2 4
.0959 .1917 .0959z( )
1 .9539 .3373z
- -
- -
- +=
+ +z
H zz
|H(Ω)| is symmetric about the real axis (Ω = 0)
| ( )| | ( )|W = - WH H
Filter Shape and Symmetry>> plot(omega/pi,angle(H))
>> title('Filter Phase Angle and Symmetry')
>> xlabel('Digital Frequency in Units of Pi')
>> ylabel('Phase Angle in Radians')
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-4
-3
-2
-1
0
1
2
3
4Filter Phase Angle and Symmetry
Digital Frequency in Units of Pi
Pha
se A
ngle
in R
adia
ns
2 4
2 4
.0959 .1917 .0959z( )
1 .9539 .3373z
- -
- -
- +=
+ +z
H zz
The phase angle is anti-symmetric about the real axis
( ) ( )Ð W=- Ð - WH H
Summary• The frequency domain of a discrete-time signal is computed from its
discrete-time Fourier transform (DTFT).• The important properties of the DTFT are its linearity, periodicity,
and its time delay property.• Use of the DTFT for spectral analysis requires consideration of
signal length (resolution) and window functions (suppression of the Gibbs phenomenon)
• Conservation of energy (Parseval’s Theorem) requires signal power to be the same in the time-domain and frequency domain
• Total signal power cannot depend on the sampling frequency• Signal power density is inversely proportional to the sampling
frequency.• The frequency response of a linear-time invariant DSP system is the
value of its transfer function on the unit circle in the complex plane, provided we interpret the angle in the complex plane as the digital frequency, Ω.