Professional Documents
Culture Documents
FFT 5 PDF
FFT 5 PDF
FFT 5 PDF
Vp ( fn ) =
T N1
()
v p t j exp(2i jn / N )
N j=0
1 N1
v p (tk ) = Vp ( fn )exp(2ikn / N )
T n= 0
t j = j t f n = nf = n / N t
Fast Fourier Transform
1
as long as n1 n2 = The indexing could also go from
N 1 to N instead of 0 to N-1
Fast Fourier Transform
Vp ( fn ) =
T N1
()
v p t j exp(2i jn / N )
N j=0
1 N1
v p (tk ) = Vp ( fn )exp(2ikn / N )
T n= 0
These discrete Fourier Transforms can be implemented
rapidly with the Fast Fourier Transform (FFT) algorithm
N (N-1)2 (N/2)log2N
256 65,025 1,024
1,024 1,046,529 5,120
4,096 16,769,025 24,576
Mathematica
1 N
Fourier[{a1,a2,,aN}] ar exp[2i(r 1)( s 1) / N ]
N r=1
lists 1 N
InverseFourier[{b1,b2,,bN}] bs exp[2i(r 1)( s 1) / N ]
N s=1
Maple
N1
FFT(N, xre, xim) x ( j )exp[2i jk / N ]
j=0
arrays N = 2n
1 N1
iFFT(N,Xre,Xim) X (k ) exp[2i jk / N ]
N k =0
MATLAB N
x ( j )exp[2i( j 1)(k 1) / N ]
fft(x) j=1
arrays 1 N
ifft(X) X ( j )exp[2i( j 1)(k 1) / N ]
N j=1
Fast Fourier Transform
FFT function
function y = FourierT(x, dt)
% FourierT(x,dt) computes forward FFT of x with sampling time interval dt
% FourierT approximates the Fourier transform where the integrand of the
% transform is x*exp(2*pi*i*f*t)
% For NDE applications the frequency components are normally in MHz,
% dt in microseconds
[nr, nc] = size(x);
if nr == 1
N = nc;
else
N = nr;
end
y = N*dt*ifft(x);
Fast Fourier Transform
[nr,nc] = size(x);
if nr == 1
N = nc;
else
N = nr;
end
y =(1/(N*dt))*fft(x);
Fast Fourier Transform
v p (t ) v(t ) tmax T = Nt
if
Vp ( f ) V ( f ) fs
1
2 fmax Nyquist
t criterion
vp(t)
| Vp(f) | N samples
N samples
T =1.0
t = T / N
dt = 0.00200400801603
dt = 0.00200000000000
Fast Fourier Transform
zero padding
v (t)
| V (f) | N samples
N samples
t f
T f =1/T fs = 1/t
v (t) | V (f) | 2N samples
2N samples
f
t
2T f =1/2T fs = 1/t
Zero padding example
dt = 0.2500 0.3
0.2
0.1
0
0 0.5 1 1.5 2 2.5 3 3.5 4
>> f =s_space(0, 1/dt, 16);
>> vf = FourierT(v, dt);
>> h = plot(f, abs(vf), 'ko');
>>axis([ 0 4 0 0.3]) 0.25
0.2
0.15
>> set(h, 'MarkerFaceColor', 'k')
0.1
>> df = f(2) - f(1)
0.05
0
df = 0.2500 0 0.5 1 1.5 2 2.5 3 3.5 4
Now, pad the original signal with zeros
could also use
>> vt2 =[v, zeros(1,16)];
vt2 = padarray(v,[0, 16], 0, post);
>> vf2 = FourierT(vt2, dt);
>> h = plot(f, abs(vf2), 'ko');
??? Error using ==> plot
Vectors must be the same lengths.
0.25
0.2
>> f =s_space(0, 1/dt, 32);
>> h = plot(f, abs(vf2), 'ko'); 0.15
0.25
0.2
0.15
0.1
0.05
0
0 1 2 3 4 5
0.6
0.5
0.4
0.3
0.2
0.1
0
-0.1
0 0.5 1 1.5 2 2.5 3 3.5 4
We can do multiple FFTs or IFFTs
all at once if we place the data in columns
0
0 0.5 1 1.5 2 2.5 3 3.5 4
Note that even though there is aliasing here if we do the inverse FFT
of these samples we do recover the original time samples:
>> v1 =IFourierT(vf1,dt);
>> h=plot(t, real(v1), 'ko');
>> set(h, 'MarkerFaceColor', 'k') 0.6
0.5
0.4
0.3
0.2
0.1
0
-0.1
0 0.5 1 1.5 2 2.5 3 3.5 4
Fast Fourier Transform
MATLAB function:
function y = pulse_ref(A,F,N, t)
y = A*(1 -cos(2*pi*F*t./N)).*cos(2*pi*F*t).*(t >= 0 & t <= N/F);
Frequency spectrum for relatively wideband pulse
>> t = s_space(0,5,512);
2
>> dt = t(2)- t(1)
1
dt = 0.0098
0
>> y=pulse_ref(1,5,3,t); -1
>> plot(t, y)
-2
0 1 2 3 4 5
>> yf1=FourierT(y,dt);
>> f=s_space(0, 1/dt, 512); 0.35
frequency 0.2
>> plot(f, abs(yf1))
Nyquist frequency
0.15
if t is in sec = sampling
f is in MHz 0.1
frequency
0.05
0
0 20 40 60 80 100 120
2
1.5
0 20 MHz -0.5
-1
-1.5
-2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
>> plot(f(1:100), abs(yf1(1:100)))
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
0 2 4 6 8 10 12 14 16 18 20
2
>> y = pulse_ref(1,5,5,t);
1.5
0.5
>> plot(f(1:100), abs(yf2(1:100)))
0
-0.5
-1
-1.5
-2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0.5
0.1
0
0 2 4 6 8 10 12 14 16 18 20
2
>> y = pulse_ref(1,5,10,t);
1
>> yf3 = FourierT(y, dt);
>> plot(f(1:100), abs(yf3(1:100))) 0
-1
-2
0 1 2 3 4 5
0.2
0
0 2 4 6 8 10 12 14 16 18 20
Show plot in more detail f is not quite adequate here
>> plot(f(1:50), abs(yf3(1:50))) f =1/T = 1/5 MHz
1
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9 10
dt = 0.0098
-1
1.2
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9 10
>> y = IFourierT(yf3, dt); Example inverse FFT (of yf3)
>> plot(t , real(y));
-1
| Vp(f) | N samples
?
in time domain
positive frequency
components fmax fs
Fast Fourier Transform
+
v(t ) = V ( f ) exp(2i f t )df
v(t ) i +
H [v(t )] = V ( f ) exp(2i f t )df
2 2 0
>> y = pulse_ref(1,5,10,t);
1
>> plot(t, y)
0
>> yf= FourierT(y, dt);
>> yf5 = yf .*(f < 50); -1
0.7
0.6
0.2
0.1
0
0 20 40 60 80 100 120
>> yf5(1) = yf5(1)/2; when throwing out negative frequency
>> y = 2*real(IFourierT(yf5, dt)); components, need to divide dc value
by half also (not needed if dc value is zero or
>> plot(t, y)
already very small)
-1
-2
0 1 2 3 4 5
Fast Fourier Transform
References