eces 390_week 1 lecture_summer 2015
DESCRIPTION
Drexel ECES 390TRANSCRIPT
-
ECES 390 Transforms IIWeek 1
Dr. Tom Chmielewski and Dr. Christopher Peters
ECE 390 - Transforms II - Chmielewski and Peters 1
-
Fourier/Inverse Fourier Transform
= =
1 = = 12
Fourier Transform:
Inverse Fourier Transform:
These are continuous functions
The Fourier transform provides the coefficients/weights (continuous function) that result by projecting f(t) onto the basis set. These coefficients provide a means to represent the signal in a different domain, while providing information of the strength of each basis function
ECE 390 - Transforms II - Chmielewski and Peters 2
-
Common Fourier Relationshipsf(t) F()
1
u(t) + 1
+ + sin
+ +
2 + + + 022
2
2
2Duality: () 2
ECE 390 - Transforms II - Chmielewski and Peters 3
-
Discretizing the Signal
Analog to Digital Converter
ComputerDigital to Analog Converter
signal
x(t) x(nTs) x(nTs) xp(t)
== + 1 What is the physicality of the above equation?
ECE 390 - Transforms II - Chmielewski and Peters 4
-
Zero Order Hold Model
Zero-Order Hold
signal
x(t) xs(t) xp(t)X
Impulse train
0
1
Ts
0
1
Ts
= = + 1
Single term input
ECE 390 - Transforms II - Chmielewski and Peters 5
-
Zero Order Hold
Square pulsePulse only contributes only during the pulse durationForms stairstep waveformReconstructed waveform is poor approximation to original waveform
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1-1
-0.5
0
0.5
1
Time (s)
Pulse Profile
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1-1
-0.5
0
0.5
1
Time (s)
Output Signal
How can we improve the reconstruction?
ECE 390 - Transforms II - Chmielewski and Peters 6
-
Zero Order Hold
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05-1
-0.5
0
0.5
1
Time (s)
Pulse Profile - fs=200 samples/sec
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05-1
-0.5
0
0.5
1
Time (s)
Output Signal
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045-1
-0.5
0
0.5
1
Time (s)
Pulse Profile - fs=479 samples/sec
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045-1
-0.5
0
0.5
1
Time (s)
Output Signal
ECE 390 - Transforms II - Chmielewski and Peters 7
-
Spectrum Representation of Sampled Signals
= =
Using superposition rule:
Any single point:
Fourier Identity: 0 0
Use Fourier transform property of superposition: the Fourier transform of total signal is equal to the sum of the individual Fourier transforms:
= =
This is called the Discrete Time Fourier Transform (DTFT)
ECE 390 - Transforms II - Chmielewski and Peters 8
-
Discrete Time Fourier Transform (DTFT)Let x(nTs)x[n], Ts
= =
=
=
Inverse DTFT: = 1211+2 = 1
22
DTFT
Discrete in time Continuous in frequency
ECE 390 - Transforms II - Chmielewski and Peters 9
-
DTFT Example = =
=
= =
= =0
= =0
Recall geometric series: =0
= 1 + + 2 + = 11 , < 1 =
=0
= 11 , < 1 = = 1 = ECE 390 - Transforms II - Chmielewski and Peters 10
-
MATLAB Exampleclose all;clear all;clc% Define the basic equationsyms wn=0:20;x=0.8.^n; % Data set x[n]X=sum(x.*exp(-j*w*n)); % DTFT of x[n]figuresubplot(2,1,1)h1=ezplot(abs(X),[-5*pi 5*pi]);set(h1,'color','b')xlabel('\Omega (rad/s)')ylim([0 5.8])title('Magnitude of DTFT')w1=-5*pi:0.01:5*pi;XX=zeros(size(w1));for K=1:length(w1)XX(K)=subs(X,w,w1(K));
endsubplot(2,1,2)plot(w1,angle(XX))xlabel('\Omega (rad/s)')title('Phase of DTFT')xlim([-5*pi 5*pi])
Is this fully correct?
ECE 390 - Transforms II - Chmielewski and Peters 11
-15 -10 -5 0 5 10 150
2
4
(rad/s)
Magnitude of DTFT
-15 -10 -5 0 5 10 15-1
-0.5
0
0.5
1
(rad/s)
Phase of DTFT
-
MATLAB Example
ECE 390 - Transforms II - Chmielewski and Peters 12
-15 -10 -5 0 5 10 150
1
2
(rad/s)
Magnitude of DTFT
-15 -10 -5 0 5 10 15-1
-0.5
0
0.5
1
(rad/s)
Phase (radians) of DTFT
close all;clear all;clcsyms w nx=0.6^n;X=symsum(x*exp(-j*w*n),n,0,Inf);w1=-5*pi:0.1:5*pi;X1=zeros(size(w1));for K=1:length(w1)
X1(K)=eval(subs(X,w,w1(K)));endfiguresubplot(2,1,1)plot(w1,abs(X1))xlabel('\Omega (rad/s)')title('Magnitude of DTFT')xlim([-5*pi 5*pi])ylim([0 2.8])subplot(2,1,2)plot(w1,angle(X1))xlim([-5*pi 5*pi])xlabel('\Omega (rad/s)')title('Phase (radians) of DTFT')
-
DTFT Linearity Example
ECE 390 - Transforms II - Chmielewski and Peters 13
-3 -2 -1 0 1 2 35
10
15
20
25
(rad/s)
Magnitude of DTFT
-3 -2 -1 0 1 2 3-1
-0.5
0
0.5
1
(rad/s)
Phase of DTFT
close all;clear all;clcsyms wn=0:10;x1=0.8.^n;x2=0.7.^n;a=3;b=4;f=a*x1+b*x2;X1=sum(a*x1.*exp(-j*w*n));X2=sum(b*x2.*exp(-j*w*n));F=sum(f.*exp(-j*w*n));w1=-pi:0.01:pi;
figuresubplot(2,1,1)h1=ezplot(abs(X1+X2),[-pi pi]);hold onh2=ezplot(abs(F),[-pi pi]);set(h2,'color','r')xlabel('\Omega (rad/s)')title('Magnitude of DTFT')subplot(2,1,2)x1h=zeros(size(w1));x2h=zeros(size(w1));Fh=zeros(size(w1));for K=1:length(w1)
x1h(K)=subs(X1,w,w1(K));x2h(K)=subs(X2,w,w1(K));Fh(K)=subs(F,w,w1(K));
endplot(w1,angle(x1h+x2h));hold onplot(w1,angle(Fh),'r');xlabel('\Omega (rad/s)')title('Phase of DTFT')xlim([-pi pi])
1 + 2 1 + 2
-
DTFT Time Shift Example
ECE 390 - Transforms II - Chmielewski and Peters 14
-3 -2 -1 0 1 2 3
5
10
15
20
Magnitude of DTFT
UnshiftedShifted
-3 -2 -1 0 1 2 3-4
-2
0
2
4
Phase (radians) of DTFT
UnshiftedShifted
close all;clear all;clcsyms wn1=0:5;n2=0:7;x1=[1 2 3 4 5 6];x2=[0 0 1 2 3 4 5 6];DTFT_unshifted=sum(x1.*exp(-j*w*n1));DTFT_shifted=sum(x2.*exp(-j*w*n2));figuresubplot(2,1,1)h1=ezplot(abs(DTFT_unshifted),[-pi pi]);hold onh2=ezplot(abs(DTFT_shifted),[-pi pi]);set(h2,'color','r')legend('Unshifted','Shifted',0)xlabel('\Omega')title('Magnitude of DTFT')subplot(2,1,2)w1=-pi:.01:pi;phase_unshifted=zeros(size(w1));phase_shifted=zeros(size(w1));for K=1:length(w1)
phase_unshifted(K)=angle(eval((subs(DTFT_unshifted,w,w1(K)))));phase_shifted(K)=angle(eval((subs(DTFT_shifted,w,w1(K)))));
endplot(w1,phase_unshifted);hold onplot(w1,phase_shifted,'r');xlim([-pi pi])legend('Unshifted','Shifted',0)xlabel('\Omega')title('Phase (radians) of DTFT')
0 0
-
DTFT Frequency Shifting
ECE 390 - Transforms II - Chmielewski and Peters 15
close all;clear all;clcw0=1; % Frequency shiftsyms wn=-5:0;x1=sin(0.1*n);x2=sin(0.1*n).*exp(j*w0*n);unshifted=sum(x1.*exp(j*w*n));shifted=sum(x2.*exp(-j*w*n));figuresubplot(2,1,1)h1=ezplot(abs(unshifted),[-pi pi]);set(h1,'color','b')hold onh2=ezplot(abs(shifted),[-pi pi]);set(h2,'color','r')xlabel('\Omega')title ('Magnitude of DTFT')legend('Unshifted','Shifted',0)subplot(2,1,2)w1=-pi:.01:pi;phase_unshifted=zeros(size(w1));phase_shifted=zeros(size(w1));for K=1:length(w1)
phase_unshifted(K)=angle(eval(subs(unshifted,w,w1(K))));phase_shifted(K)=angle(eval(subs(shifted,w,w1(K))));
endplot(w1,phase_unshifted)hold onplot(w1,phase_shifted,'r')xlabel('\Omega')ylabel('Phase (radians) of DTFT')legend('Unshifted','Shifted',0)xlim([-pi pi])
0 0
-3 -2 -1 0 1 2 3
0.5
1
1.5
Magnitude of DTFT
UnshiftedShifted
-3 -2 -1 0 1 2 3-4
-2
0
2
4
Pha
se (r
adia
ns) o
f DTF
T
UnshiftedShifted
-
Discrete Fourier Transform Continuous spectrum
Fourier transform Discrete Time Fourier Transform
Concern with modern technology Cant store an infinite set of frequencies on electronic media. HOW DO WE APPROXIMATE THE FREQUENCY CONTENT OF A DISCRETE SIGNAL?
Practical Issues Finite set of discrete values N = number of samples chosen to represent the discrete time series N must be large enough to represent the signal
Our objective: We seek an approximation of Fourier transforms that can be computed from a finite set of discrete samples of an analog signal which produces a finite set of discrete frequency spectrum values
Solution: Compute discrete-frequency samples of continuous frequency function X()ECE 390 - Transforms II - Chmielewski and Peters 16
-
Approach to a Solution
Define a rectangular window
= 1, = 0, 1, 2, 10, Multiply infinite set x[n] by wR[n]
= = , = 0, 1, 2, 10, Intermediate step yields discrete time Fourier transform of windowed signal
= = =
=
=0
1
Still continuous We can drop the subscript N if desiredECE 390 - Transforms II - Chmielewski and Peters 17
-
Approach to a Solution Select N equal-distance samples of XN() to represent the frequency spectrum
Need at least N discrete frequency values (could use more) to avoid errors if the inverse DFT is desired Recall the DTFT is periodic with a periodicity of 2 = + 2
= =0
1
2
=
=0
1
2
2
Value of frequency spectrum at each desired, discrete frequency Impulse in frequency domain
Set of discrete values 2
is information we select to represent the frequency spectrum of discrete
time sequence x[n} and xN[n]
ECE 390 - Transforms II - Chmielewski and Peters 18
-
Discrete Fourier Transform Continued
Convention: = 2 , = 0,1,2, 1Since x[n] is finite, it is a nonperiodic discrete time sequence, and therefore we only need N samples
= 1=0
1
2 , = 0, 1, 2, 1
N discrete samples from a set of N samples of discrete time signal
X = = =01 2 , = 0, 1, 2, 1x = 1 = 1
=01
2 , = 0, 1, 2, 1
ECE 390 - Transforms II - Chmielewski and Peters 19
-
DFT Example
-0.5 0 0.5 1 1.5 2 2.5 3 3.5
0
2
4
6
k
|Xk|
-0.5 0 0.5 1 1.5 2 2.5 3 3.5
-2
0
2
k
X k
(rad
ians
)
close all;clear all;clcx=[1 2 2 1];N=length(x);X=zeros(1,length(x));Xk=zeros(1,length(x));for k=0:N-1
for n=0:N-1X(n+1)=x(n+1)*exp(-j*2*pi*k*n/N);
endXk(k+1)=sum(X);
endfiguresubplot(2,1,1)stem(0:N-1,abs(Xk),'filled')xlim([-.5 3.5])ylim([-0.5 6.5])xlabel('k')ylabel('|X_k|')subplot(2,1,2)stem(0:N-1,angle(Xk),'filled')xlim([-.5 3.5])ylim([-3.5 3])xlabel('k')ylabel('\angleX_k (radians)')
ECE 390 - Transforms II - Chmielewski and Peters 20
-
DFT Function
function Xk=dft(x)N=length(x);Xk=zeros(1,length(x));X=zeros(1,length(x));for k=0:(N-1)
for n=0:(N-1)X(n+1)=x(n+1)*exp(-j*2*pi*k*n/N);
endXk(k+1)=sum(X);
endend
ECE 390 - Transforms II - Chmielewski and Peters 21
-
DTFT Property - Periodicity
0 2 4 6 8 10 12 140
10
20
30
k
|Xk|
0 2 4 6 8 10 12 14-4
-2
0
2
4
k
X k
close all;clear all;clcn=0:4;x=n.^2;N=length(x);for k=0:(3*N-1);a
for n=0:(N-1)X(n+1)=x(n+1)*exp(-j*2*pi*k*n/N);
endXk(k+1)=sum(X);
end
figuresubplot(2,1,1)stem(0:(3*N-1),abs(Xk),'filled')xlabel('k')ylabel('|X_k|')subplot(2,1,2)stem(0:(3*N-1),angle(Xk),'filled')xlabel('k')ylabel('\angleX_k')
ECE 390 - Transforms II - Chmielewski and Peters 22
-
DFT Property - Linearity
0 0.5 1 1.5 2 2.5 3 3.5 40
20
40
60
k
X k
X1+X2X3
0 0.5 1 1.5 2 2.5 3 3.5 4-2
-1
0
1
2
k
X k
X1+X2X3
close all;clear all;clcx1=[5 2 1 9 6];x2=[9 1 7 8 6];x3=x1+x2;k=0:(length(x1)-1);X1=dft(x1);X2=dft(x2);X3=dft(x3);figuresubplot(2,1,1)stem(k,abs(X1+X2),'filled')hold onstem(k,abs(X3),'filled','r')xlabel('k')ylabel('\angleX_k')legend('X1+X2','X3',0)subplot(2,1,2)stem(k,angle(X1+X2),'filled')hold onstem(k,angle(X3),'filled','r')xlabel('k')ylabel('\angleX_k')legend('X1+X2','X3',0)
ECE 390 - Transforms II - Chmielewski and Peters 23
-
DFT Property Parsevals
close all;clear all;clcx=[9 1 2 9 3 4]Ex=sum(x.^2)X=dft(x)EX=1/length(x)*sum(abs(X.^2))
ECE 390 - Transforms II - Chmielewski and Peters 24
-
Inverse DFT
function x=idft(X)N=length(X);x=zeros(1,length(X));K=zeros(1,length(X));for n=0:(N-1)
for k=0:(N-1)K(k+1)=X(k+1)*exp(j*2*pi*k*n/N);
endx(n+1)=sum(K)/N;
endend
ECE 390 - Transforms II - Chmielewski and Peters 25
-
Compare and Contrast DFT and IDFT
function Xk=dft(x)N=length(x);Xk=zeros(1,length(x));X=zeros(1,length(x));for k=0:(N-1)
for n=0:(N-1)X(n+1)=x(n+1)*exp(-j*2*pi*k*n/N);
endXk(k+1)=sum(X);
endend
function x=idft(X)N=length(X);x=zeros(1,length(X));K=zeros(1,length(X));for n=0:(N-1)
for k=0:(N-1)K(k+1)=X(k+1)*exp(j*2*pi*k*n/N);
endx(n+1)=sum(K)/N;
endend
X = =01 2/ x = 1=01 2/
ECE 390 - Transforms II - Chmielewski and Peters 26
-
Comparison of DFT to DTFT
= = =0
1
X = = =01 2 , = 0, 1, 2, 1
ECE 390 - Transforms II - Chmielewski and Peters 27
= =
2
, = 0, 1, 2, 1
-
Example DFT - 3 Data Points (N=3)
= =0
2
2
0 = 0 2 0 03 + 1 2 0 13 + 2 2 0 23 = 0 + 1 + 2 1 = 0 2 1 03 + 1 2 1 13 + 2 2 1 23 = 0 + 1 23 + 2 43 2 = 0 2 2 03 + 1 2 2 13 + 2 2 2 23 = 0 + 1 43 + 2 23
ECE 390 - Transforms II - Chmielewski and Peters 28
-
Example IDFT-3 Data Points (N=3)
= 13=0
2
2
0 = 13 0 2 0 03 + X 1 2 1 03 + X 2 2 2 03 = 13 0 + 1 + 2 1 = 13 0 2 0 13 + X 1 2 1 13 + X 2 2 2 13 = 13 0 + 1 23 + 2 43 2 = 13 0 2 0 23 + X 1 2 1 23 + X 2 2 2 23 = 13 0 + 1 43 + 2 23The symmetry of two sets of equations (DFT and IDFT) allows computation using one set of computer codes
ECE 390 - Transforms II - Chmielewski and Peters 29
-
Periodic signals
-3 -2 -1 0 1 2 3 4 5 6
x[-3] x[-2] x[-1] x[0] x[1] x[2] x[3] x[4] x[5] x[0] x[1] x[2] x[0] x[1] x[2] x[0] x[1] x[2]
If we compute k>(N-1) and soon
X 3 = =0
2
2 3
3 = 0 + 1 + 2 = 0ECE 390 - Transforms II - Chmielewski and Peters 30
-
Shorthand Notation of the DFT
Let = 2 = =
=0
1
, = 0,1, 1
= = =0
1
, = 0,1, 1
ECE 390 - Transforms II - Chmielewski and Peters 31
-
Frequency Resolution of DFT
N frequency samples, with a period of 2
Separation between samples: = 2
Given N1 samples in the discrete time domain, is fixed. To increase the resolution, there needs to be more sampling in the frequency domain, which means increasing N, the number of discrete time domain points
In certain circumstances, zero padding (adding zeros at the end) can be done, but the resolution DOES NOT get better (we will discuss this later, but this comes from information theory)
ECE 390 - Transforms II - Chmielewski and Peters 32
-
Understanding WN = 2Let N=8: k=0, 1, 2, 7
8 = 28 = 4
= 0: 80 = 1 = 1: 81 = 4
= 2: 82 = 2 = 3: 83 = 34 = 4: 84 = = 1
= 5: 85 = 54 = 6: 86 = 23 = = 7: 87 = 78 Adjacent vector: Angle of 2
radians
Each vector has an opposite of equal magnitude=1. This leads to the sum of all vectors=0. =07
= 0 Each vector has an associated conjugate pair which
is in
ECE 390 - Transforms II - Chmielewski and Peters 33
-
Understanding WN = 2Expanding Notation: = 2
80 = 1
81 = 14
82 = 12 87 = 174
Observations: n=0: All vectors=1n=1: Previous vector field shown previouslyn>1: Vectors repeat pattern
82 5 = 125 = 1 12+42 = 12
87 5 = 1354 = 1 34+324 = 134
Summarizing: =0
=1
0 =
=0
=1
= 0, = 1, 2, 1
ECE 390 - Transforms II - Chmielewski and Peters 34
-
Validity of DFT = 2
= 1=0
1
= 1
=0
1
=0
1
= 1=0
1
=0
1
= 1
=0
1
=0
1
Note: =0
1
= , = 0,
= 1 =
ECE 390 - Transforms II - Chmielewski and Peters 35
-
MATLAB Implementationclose all;clear all;clc % Initialize scriptx=[1 2 3 4]; % Define discrete time series dataN=length(x); % Gets the number of points in sequenceW=exp(-j*2*pi/N)% Display magnitude and phase of Wdisp(['Magnitude of W = ' num2str(abs(W))])disp(['Angle of W = ' num2str(angle(W)) ' radians'])% Calculate the N point DFTXk=zeros(1,N); % Create and initialize frequency arrayfor k=0:1:(N-1)
for n=0:1:(N-1)Xk(k+1)=Xk(k+1)+x(n+1)*W^(k*n);
endend% Plot the magnitude and phase of Xkfiguresubplot(2,1,1)stem(0:1:(N-1),abs(Xk),'filled','r','linewidth',3)title('Magnitude of X[k], the DFT of x[n]')axis([-1,N,0,1.1*max(abs(Xk))])grid onxlabel('k - frequency sample')subplot(2,1,2)stem(0:1:(N-1),angle(Xk),'filled','r','linewidth',3)title('angle of X[k], the DFT of x[n]')axis([-1,N,-1.1*max(abs(angle(Xk))),1.1*abs(max(angle(Xk)))])grid onxlabel('k - frequency sample')ylabel('angle of x[k], radians')
-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 40
5
10
Magnitude of X[k], the DFT of x[n]
k - frequency sample
-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4
-2
0
2
angle of X[k], the DFT of x[n]
k - frequency sample
angl
e of
x[k
], ra
dian
s
ECE 390 - Transforms II - Chmielewski and Peters 36
-
Calculating the IDFT using the DFT
= 1=0
1
=
=0
1
DFT: IDFT:
Conjugate IDFT
= 1=0
1
Conjugate result to get x[n]
DFT of X*[k]
= = 1
=0
1
2
1) Change X[k] to X*[k]2) Conduct DFT on X*[k] to get Nx*[n]3) Conjugate Nx*[n] to get Nx[n]4) Divide by N to get x[n]
Process
ECE 390 - Transforms II - Chmielewski and Peters 37
-
Using FFT in MATLAB to get the DFT and IDFT
FFT is efficient when N=2m, a power of 2
FFTx[n] X[k]
FFT x[n]X[k]
conjugateX*[k] Nx*[n]
conjugateNx[n]
Divide by N
Important MATLAB Commands to use: FFT, conj
ECE 390 - Transforms II - Chmielewski and Peters 38
-
Convolution Review
LTI System
= =
=
Convolution in one domain yields multiplication in the other domain
Let 1 1 , 2 2 1 2 1 2
1 2 12
1 2
=
ECE 390 - Transforms II - Chmielewski and Peters 39
-
Linear Convolution of Discrete Signals
Discrete, linear convolution = =
Let N be the length of one sequence, and M be the length of the other sequence. The convolution yields a sequence of length N+M-1
Let = 1 2 3 , = 2 4 6 = [2 8 20 24 18] Graphically (fold and shift) Use equation
Synthetic multiplication Table Computer program (e.g.,MATLAB)
Methods to conduct linear convolution
ECE 390 - Transforms II - Chmielewski and Peters 40
-
Example: Using equation
= =
Hint: only need to use indices that add up to n
Let = 1 2 3 , = 2 4 6 0 = 0 0 = 1 2 = 2 1 = 0 1 + 1 0 = 1 4 + 2 2 = 8 2 = 0 2 + 1 1 + 2 0 = 1 6 + 2 4 + 3 2 = 20 3 = 1 2 + 2 1 = 2 6 + 3 4 = 24 4 = 2 2 = 3 6 = 18
ECE 390 - Transforms II - Chmielewski and Peters 41
-
Example: Using Synthetic Multiplication
= =
Hint: only need to use indices that add up to n
Let = 1 2 3 , = 2 4 6 2 4 6 1 2 3
6 12 18
4 8 12
2 4 6
2 8 20 24 18
ECE 390 - Transforms II - Chmielewski and Peters 42
-
Convolving with sequences of nonzero starting sequences
= =
Consider the sequences 1 = 5 1 9 2 4 2 = 1 4 2 3
Recall: only need positions where m+n=new index for y
Most negative index: min(-2-1,-2-2)=-4
1 2 = =
1 2 = [5 21 23 55 33 47 14 12]
Most positive index: min(1-(-2),2-(-2))=-3
ECE 390 - Transforms II - Chmielewski and Peters 43
-
Can We Use the DFT to Convolve Linearly?Can we find y[n] if Y[k]=X[k]H[k}?
= = =0
1
2
=0
1
2
DFT(x) DFT(h)
= 1=0
1
=0
1
2
=0
1
2
2
Use math rules to pull out x[l] and h[m], and combine exponents
= 1=0
1
=0
1
=0
1
2
=0
1
2
= , = 00, ECE 390 - Transforms II - Chmielewski and Peters 44
-
Can We Use the DFT to Convolve Linearly?
= 1=0
1
=0
1
Thus,
= 1 = Therefore,
= 1=0
1
This looks like linear convolution, but the summation is over one period rather than all time. This is called circular convolution, with the operation denoted by
= = =0
1
DFT In circular convolution, both
data sets must have the same number of elements
ECE 390 - Transforms II - Chmielewski and Peters 45
-
Circular Convolution Example1 = 1 2 3 42 = 0 1 2 3 = 1 2
MATLAB code = 1 . 2 = 10 2 + 2 2 2 2 . 6 2 + 2 2 2 2 = 60 4 = 16 18 16 10
ECE 390 - Transforms II - Chmielewski and Peters 46
-
Circular Convolution-General Case 0
1
2
3 4
5
6
7 0
1 2
3 4 5
6 7
Outer ring is in counter-clockwise (CCW) order, inner ring is in clockwise (CW) order
Only rotate inner ring CCW. Outer ring is stationary.
Multiply, add, and shift inner ring CCW
ECE 390 - Transforms II - Chmielewski and Peters 47
-
Rotating Method-Previous Example1 = 1 2 3 4 2 = 0 1 2 3
1
2
3
4
0
1
2
3
0 = 1 0 + 2 3 + 3 2 + 4 1 = 16
1
2
3
4
1
2
3
0
1 = 1 1 + 2 0 + 3 3 + 4 2 = 18ECE 390 - Transforms II - Chmielewski and Peters 48
-
Rotating Method-Previous Example1 = 1 2 3 4 2 = 0 1 2 3
1
2
3
4
2
3
0
1
2 = 1 2 + 2 1 + 3 0 + 4 3 = 16
1
2
3
4
3
0
1
2
3 = 1 3 + 2 2 + 3 1 + 4 0 = 10ECE 390 - Transforms II - Chmielewski and Peters 49
-
Can We Use the FFT To Conduct Linear Convolution?1 2 3 4 0 1 2 3 = 0 1 4 10 16 17 12 (length N=7)Because the convolution is 7 points long, we can add enough zeroes to each sequence such that the length of each modified sequence is 7 points long1 2 3 4 0 0 0 0 1 2 3 0 0 0
1 2
This gives the correct results when using the FFT in approach
1 2 = 1 2
1 2
1 . 2 = ECE 390 - Transforms II - Chmielewski and Peters 50
-
Convolution Example Equal Lengths
close all;clear all;clcx=[5 1 9 2]h=[1 9 2 4]L=length(x)+length(h)-1;y1=conv(x,h) % MATLAB linear convolution command% Conduct linear convolution using DFTy2=ifft(fft(x,L).*fft(h,L))% Conduct circular convolution using DFTy3=ifft(fft(x).*fft(h))
ECE 390 - Transforms II - Chmielewski and Peters 51
-
Convolution Example-Unequal Lengths
close all;clear all;clcx=[5 1 9 2 9 9]h=[1 9 2 4]L=length(x)+length(h)-1;y1=conv(x,h)y2=ifft(fft(x,L).*fft(h,L))
ECE 390 - Transforms II - Chmielewski and Peters 52
-
Signal EnergyRecall Parsevals Equation
=
2 = 12
2 = 10
2
Energy spectral density function
= 1 2 = 1 Energy in frequency band of interest
1
2
ECE 390 - Transforms II - Chmielewski and Peters 53
-
Example of Parsevals Equation
% Define data set x[n]x=[1 2 -3 4 5]% Calculate DFT of x[n]Xk=fft(x)% Calculate energy in time domainEx=sum(abs(x).^2)% Calculate energy in frequency domainEXk=sum(abs(Xk.^2))/length(x)
ECE 390 - Transforms II - Chmielewski and Peters 54
-
Parsevals Equation Continued
General case of Parsevals equation: =0
1
= 1=0
1
If y[n]=x[n], =0
1
2 = 1=0
1
2
What Parsevals equation is stating is the total energy time domain is equal to the total energy in the frequency domain
ECE 390 - Transforms II - Chmielewski and Peters 55
-
Discrete Time Fourier Series (DTFS)x[n] is periodic with period N: = + , Because there are N points in the period, there are N harmonically related exponential functions
2 , = 0, 1, . . 1
Synthesis equation: = =0
1
2
Analysis equation: = 1=0
1
2
Periodic condition: + =
Because the Fourier Series is for periodic signals, we only need to have N points (one period) to provide a complete description of the signal
ECE 390 - Transforms II - Chmielewski and Peters 56
-
Power Spectral Density of Periodic Signals
= 1=0
1
2 Power in the discrete time domain
= =0
1
2 Average power in the discrete frequency domain
If x[n] is a real sequence, =
ECE 390 - Transforms II - Chmielewski and Peters 57
ECES 390 Transforms IIWeek 1Fourier/Inverse Fourier TransformCommon Fourier RelationshipsDiscretizing the SignalZero Order Hold ModelZero Order HoldZero Order HoldSpectrum Representation of Sampled SignalsDiscrete Time Fourier Transform (DTFT)DTFT ExampleMATLAB ExampleMATLAB ExampleDTFT Linearity ExampleDTFT Time Shift ExampleDTFT Frequency ShiftingDiscrete Fourier TransformApproach to a SolutionApproach to a SolutionDiscrete Fourier Transform ContinuedDFT ExampleDFT Function DTFT Property - PeriodicityDFT Property - LinearityDFT Property ParsevalsInverse DFTCompare and Contrast DFT and IDFTComparison of DFT to DTFTExample DFT - 3 Data Points (N=3)Example IDFT-3 Data Points (N=3)Periodic signalsShorthand Notation of the DFTFrequency Resolution of DFTUnderstanding WNUnderstanding WNValidity of DFTMATLAB ImplementationCalculating the IDFT using the DFTUsing FFT in MATLAB to get the DFT and IDFTConvolution ReviewLinear Convolution of Discrete SignalsExample: Using equationExample: Using Synthetic MultiplicationConvolving with sequences of nonzero starting sequencesCan We Use the DFT to Convolve Linearly?Can We Use the DFT to Convolve Linearly?Circular Convolution ExampleCircular Convolution-General CaseRotating Method-Previous ExampleRotating Method-Previous ExampleCan We Use the FFT To Conduct Linear Convolution?Convolution Example Equal LengthsConvolution Example-Unequal LengthsSignal EnergyExample of Parsevals EquationParsevals Equation ContinuedDiscrete Time Fourier Series (DTFS)Power Spectral Density of Periodic Signals