



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




ME2016, Dr. Ferri DFT Example
Consider the function
f (t) = 0_._ 5 + 0_._ 75 cos(t) − 0_._ 3 sin(t) + cos( 2 t) − 0_._ 4 sin( 2 t) + 0_._ 8 cos( 3 t )
From this expression it is evident that a 0 = 1.0, a 1 = 0.75, b 1 = -0.3, a 2 = 1, b 2 = -0.4, a 3 = 0.8. The function is created using the following Matlab code and is plotted below using N=256 points over a time period of 2π seconds.
N=256; delt=2pi/N; T=Ndelt; t=0:delt:(N-1)delt; a0=1.0; a1=0.75; b1=-0.3; a3=0.8; a2=1; b2=-.4; f=a0/2+a1cos(t)+b1sin(t)+a2cos(2t)+b2sin(2t)+a3cos(3*t);
plot(t,f); xlabel('t'); ylabel('f')
0 1 2 3 4 5 6 7
-1.
-0.
0
1
2
3
t
f
The first 11 DFT values are calculated using the following Matlab commands:
for k=1:11; F(k) = 0; for r=1:N; angle = (k-1)(2pi/N)(r-1); F(k) = F(k) + f(r)exp(-i*angle); end end
Note that the index k goes from 1 to 11, which corresponds to the subscript k (in, for example, fk and Fk) going from 0 to 10. In tabular form, the first 11 values of F are given by:
k k ω 0 Real(Fk ) Imag(Fk ) 0 0.0 128.0 0 1 1.0 96.0 38. 2 2.0 128.0 51. 3 3.0 102.4 0 4 4.0 0 0 5 5.0 0 0 6 6.0 0 0 7 7.0 0 0 8 8.0 0 0 9 9.0 0 0 10 10.0 0 0
These 11 complex values Fk are identical to those that would have been obtained using the Matlab
below.
0 1 2 3 4 5 6 7 8 9 10
0
20
40
60
80
100
120
140
Frequency (rad/s)
DFT
DFT Based on exact freq. amps
Aperiodic Signal Often, we use FFT’s to analyze systems that don’t repeat. For example, we can have a signal that is zero after some transient event is over. Here, we consider a unit pulse of duration 5/16 sec., followed by zero values for t > 5/16 sec; the signal is said to be “padded with zeros” beyond 5/ sec. Using a sampling interval of 1/16 sec, and N = 16 samples, the signal is as shown below. Although the true signal is zero for t > 1 sec, the FFT has no way to know that, and it assumes that it repeats with period 1 sec. The signal, shown plotted below, can be generated using the commands
t=0:(1/16):15/16; f=[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0];
(^00) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
Time (sec)
f
The DFT of the signal can be calculated using the Matlab command >> F=fft(f); The magnitude of the DFT of f is shown below. Note that the magnitude plot is symmetric about the 9th point since N/2 = 8, which corresponds to the 9th^ element in the vector F.
0 10 20 30 40 50 60 70 80 90 100 0
1
2
3
4
5
Frequency (rad/s)
Magnitude of F
Note that, as before, FN-k = conj( Fk ) for k = 1 to 7. Also, note that FN/2 = F 8 is real valued. The