The Discrete Fourier Transform: Frequency axes
Contents
- Background
- The DFT in terms of cyclic frequency (Hz)
- The DFT in terms of normalised cyclic frequency (cycles per sample)
- The DFT in terms of normalised radian frequency (radians per sample)
1 Background
The DFT defined earlier is agnostic to sample rate — i.e., the concept of `frequency’ is in a relative sense, normalised by the total number of samples, . However, when dealing with real-world audio and acoustics signals it can be helpful to interpret the DFT bins in terms of either cyclic frequency, normalised cyclic frequency, or normalised radian frequency.
A couple of foundational points:
- Define a sample rate , which tells us how many times per second we sample the signal . For example, implies a sample rate of 48kHz, or 48000 samples per second.
- By extension, tells us the sample period (aka the time delay between consecutive samples) via . is measured in seconds (per sample).
2 The DFT in terms of cyclic frequency (Hz)
Let us define
(1)
Here, is in units of cycles per second (i.e., Hz), and is in units of seconds. Each value of is referred to as a DFT analysis frequency, since it sets the frequency of the given complex exponential phasor onto which we project , as per equation 3.
The units of are understood as cycles per second (Hz) via a units analysis, whereby
(2)
and where we note that is a dimensionless index. The `cycles’ term is implied by the context in which is used, i.e., to determine the repetition rate of a complex exponential phasor, since the top half of the ratio in equation 2 is dimensionless.
This allows us to write the DFT in the form
(3)
Notice the following:
- Inserting the expressions for and into equation 3 returns the original DFT expression, in terms of bin indices and sample index .
- For we have , which corresponds to the 0 Hz (aka `DC’, aka `zero frequency’) complex exponential.
- For we have , which is the frequency of the first non-zero frequency bin, and by extension, the frequency resolution of the -point DFT as a whole, i.e., the spacing between each pair of bins, expressed in Hz.
- spans the range from (strictly speaking, from , since it needs to stop 1 bin below ). Note that some writers denote this as , where `[‘ specifies inclusion of , and `)’ the exclusion of (i.e., stopping 1 bin below), and the suffix reminds us that the range is discrete.
- Since the DFT operates on a finite length, discrete time signal, the available analysis frequencies are said to be band limited (i.e., they span the range from , and discrete valued (i.e., there are exactly of them). The band limiting property is interesting, because strictly speaking we can define in terms of any range of values that span . For example, the range is often used, in which the `upper half’ of the analysis frequency range is mapped to negative frequency.
When writing your own DSP code, such as in Matlab, all of the above makes it straightforward to produce a frequency axis in Hz for a given use of the DFT. Here is a simple example, written in Matlab:
N = 6400; % Length of discrete time signal x = 2*(rand(N, 1)-0.5); % Dummy discrete time signal F = 48000; % Sample rate T = 1/F; % Sample period df = F/N; % Frequency resolution (in Hz) fVec = [0:df:F-df]; % Frequency vector (spans full bandwidth, in Hz) x_dft = fft(x); % Transform the signal into the discrete frequency domain plot(fVec,abs(x_dft)) % Plot the DFT magnitude against frequency (in Hz)
3 The DFT in terms of normalised cyclic frequency (cycles per sample)
Another useful way to write the DFT equation is in terms of a normalised cyclic frequency, , with units of cycles per sample. In this case, defines the number of cycles of phase swept out by a given complex exponential phasor per tick of the sample clock.
(4)
The units of are understood as cycles per sample via a units analysis, whereby
(5)
and where we note that is a dimensionless index. The `cycles’ term is implied by the context in which is used, i.e., to determine the repetition rate of a complex exponential phasor, since the top half of the ratio is dimensionless.
This permits a DFT expressed as
(6)
The normalised frequency, spans the range from (strictly speaking, from since it needs to stop 1 bin below the normalised frequency limit). As earlier, we can denote this as .
Notice the following:
- As expected corresponds to the zero-frequency complex exponential.
- defines a complex exponential that almost, but not quite, completes one complete rotation on the complex plane for each tick of the sample clock. If we imagine further increasing to specify , we see that the complex exponential in equation 6 reduces to , which always evaluates to 1 for integer . The corresponding then simply returns the sum of over its values, which is equivalent to projection onto the zero-frequency complex exponential. In other words, is the alias of , and provides no new information about .
Here is a simple example, written in Matlab, that illustrates the creation of a normalised cyclic frequency axis:
N = 6400; % Length of discrete time signal x = 2*(rand(N, 1)-0.5); % Dummy discrete time signal fVec = (1/N)*[0:N-1]'; % Frequency vector (spans 0:1, in cycles/sample) xdft = fft(x); % Transform the signal into the discrete frequency domain plot(fVec,abs(xdft)) % Plot the DFT magnitude against normalised frequency
4 The DFT in terms of normalised radian frequency (radians per sample)
Yet another useful way to write the DFT equation is in terms of a normalised radian frequency, , with units of radians per sample. In this case, defines the number of radians of phase swept out by a given complex exponential phasor per tick of the sample clock.
(7)
where we first used in equation 4. The units of are understood as radians per sample via a units analysis, whereby
(8)
and where we note that is a dimensionless index.
This allows us to express the DFT as
(9)
The normalised radian frequency, spans the range from (strictly speaking, from since it needs to stop 1 bin below the normalised frequency limit). As above, we can denote this by .
Here is a simple example, written in Matlab, that illustrates the creation of a normalised radian frequency axis:
N = 6400; % Length of discrete time signal x = 2*(rand(N, 1)-0.5); % Dummy discrete time signal fVec = (2*pi/N)*[0:N-1]'; % Frequency vector (spans 0:2*pi, in radians/sample) xdft = fft(x); % Transform the signal into the discrete frequency domain plot(fVec,abs(xdft)) % Plot the DFT magnitude against normalised radian frequency