You are on page 1of 3

In spectral analysis it is important to note that the discrete Fourier transform

(DFT) and its associated inverse (IDFT) can be represented in more than one
form. The method by which other functions of the DFT are computed depends
on an understanding of which DFT type was used. Presented here are two forms
of the DFT and an example of how the power-spectral-density function, by
example, is determined for each form. The first is labeled here as the DFT
proper since it is the derived equivalent of the continuous Fourier transform. The
second form, however, is more commonly implemented in practice (including
data analysis programs such as LabView or MATLAB), and thus is labeled here
as the algorithmic DFT.

DFT Proper:
The continuous Fourier transform for a given function h(t ) is given as


H(f )= ∫ h(t )e−i 2π ft dt
−∞

with the following inverse


h(t )= ∫ H(f )ei 2π ft df
−∞

A discrete and periodic form of these transformations are

N−1 nm
−i2 π
N
H m= Δt ∑ hn e
n=0

M −1 nm
i2 π
N
hn =Δf ∑ H me
m=0

since t n=nΔt and f m=mΔf =m/(NΔt ) .


If h has the generic units of h and t is in seconds then H has the units of
h/Hz. [It can be argued that the unit 1/cycle can be correctly added to the
transform. Although no formal literature has been found to assert this, the
−iθ
concept can be strengthened if the radian form is considered, e . In this
case the transform and its inverse are not symmetric requiring a scaling factor of
2 π to be appropriated between the transforms. The arbitrary unit of radians
can be assigned, as allowable, and combined with the scaling factor to produce
the unit cycles. Since the transform should be invariant of the choosing of cycles
or radians (the exponential e has no units), the form as presented should also
include the unit cycles to make both versions (radian and cycle) of the transforms
compatible.] Since H is complex the units on the spectral density have little
applicable meaning; however it is important to note for the calculation of the
power spectral density which is real valued. The calculation of the power
spectral density function is given as

¿
G=H HΔf

with the units of h^2/Hz. The function H ¿ is the complex conjugate of H .

The Algorithmic DFT:


For most applications the DFT has been defined to be invariant of a scaled time
and frequency. The algorithm then only requires information on the data series
hn for calculation. By observing from before that

Δf =1/( NΔt )

the discrete transform set can be rewritten by dividing the DFT by Δt . This
also requires multiplying the IDFT by Δt to maintain correct scaling.

N−1 nm
−i2 π
N
H^ m= ∑ hn e
n=0

M −1 nm
1 i2π
N
hn = ∑ H^ m e
N m=0
In this form the units ofH^ m and hn are identical since no information
^
regarding time or frequency is conveyed. H m is distinguished from
H m since
the results of these two functions are proportional, but not equal. The calculation
of the power spectral density however still requires frequency information, but
because of the redefinition of the transform it now becomes

H^ ¿ H^
G= 2
N Δf

in order to maintain the correct units. Below is a MATLAB example illustrating


the calculation of a PSD for a sinusoidal oscillation at 64Hz and of amplitude 1. If
the units for this signal are volts/sqrt(Ohm) [eg. 1 volt acting across a 1 Ohm
resistor] then the expected total power output would be 0.5 watts [an equivalent
DC source with a magnitude of the RMS of the signal, or 1/sqrt(2)
volts/sqrt(Ohm), will produce the same power]. The power output is invariant to
the frequency. The plot of the PSD is multiplied by 2 since we are plotting only
the range below the Nyquist frequency, but still need to account for the power of
the mirroring side.

Fs=1000; % sample rate [samples/second]


dt=1/Fs; % sample time [seconds]
N=2048; % number of samples
T=N*dt; % sample period [seconds]
t=linspace(0,T,N); % time vector [seconds]
h=sin(2*pi*64*t); % signal [volts/sqrt(Ohm)]

df=1/T; % frequency bin size [Hz]


f=linspace(0,1/dt,N); % frequency vector [Hz]

H=fft(h); % FFT of h [volts/sqrt(Ohm)/Hz]

G=conj(H).*H/N/N/df; % PSD of h [(volts^2/Ohm)/Hz or Watts/Hz]

TotalPower = sum(G)*df % Total Power [Watts]

plot(f(1:(N/2-1)),2*G(1:(N/2-1))) % [Hz] [Watts/Hz]

You might also like