# Frequency

The Frequency spectrum of the current function is displayed in the Frequency tab. plotXpose calculates the Discrete Fourier Transform when defined over the positive frequencies. The Fourier Transform cannot be calculated by plotXpose if there is irregular sampling or if the function has Undefined ValuesFour representations are available the Frequency tab:

- Real

- Imaginary

- Amplitude

- Phase

Positive frequencies are displayed only.

For a Periodic Function, the values given by the Discrete Fourier Transform will equal the Fourier coefficients, calculated for the original continuous function, as long as the following conditions hold:

- The Sampling Interval has been chosen to be smaller than 1/(2*fmax), where fmax is the maximum frequency in the function.

- We have an exact number of sample intervals within a single period

- A whole number of periods are encompassed by the current t-axis limits.

## Example - Comparison between Fourier Coefficients and Discrete Fourier Transform

The function cos(pi*t) has fundamental period 2 and frequency 0.5, it has an amplitude of 1 and phase of zero..1 The Fourier series2, in amplitude and phase form, gives 1 for the amplitude at a frequency of 0.5 and a phase of 0, and an amplitude of 0 for all other frequencies. If we choose use plotXpose and choose a sample interval less than or equal to 1/(2*0.5) and an axis range which encompasses a whole number of periods of the function we should get the result of approximately 1 for the amplitude and 0 for the phase at a frequency of 0.5 and zero amplitude elsewhere.For cos(pi*t) we could choose a sampling interval of 0.1 and, for the minimum and maximum t values, (0,2), (-0.25, 1.75), (-4,0), (-6.2, 3.8), all of which encompass a complete number of cycles, so should give approximately the same result for the Frequency Spectrum, i.e. amplitude 1 and phase 0 at a frequency of 2 with 0 amplitude elsewhere.

There follows a short explanation of the relationship between a Fourier Series of a periodic function and the Discrete Fourier Transform of the sampled function.

## The Discrete Fourier Transform

Supposing we have a periodic function, f(t), with fundamental period, T , then we have seen 2 that f(t) can be represented by the complex form of the Fourier Series:is the fundamental angular frequency. Hence the fundamental frequency is given by f0= 1/T. The coefficients in the Fourier series can be obtained by:

We now look at the problem of finding a Fourier series of the discrete function, which results from sampling a continuous periodic function. In Chapter 1 of 'Mathematics for Electrical Engineering and Computing' we considered the problem of sampling a function. The sampling theorem states that to represent a frequency of fmax the maximum sampling interval that can be used is h = 1/(2fmax). Another consideration is that we want to sample so that we get an exact number of points in a single period (otherwise the discrete representation of the function will not have the same period as the original function). In which case if we have N intervals in a single period we have

Nh =T

Rearranging h=1/(2fmax) we find fmax= N/(2T)= (N/2)f0

This shows that for a function, that can accurately be represented by a sampled function, the maximum value of n for which the Fourier coefficient is non-zero, must be n=N/2 where N is the number of sample points in a single period. We now have a finite sum for the Fourier series:

For a function that can be represented at the sample points, t=mh, by the discrete function fm=f(mh) then we get

To find the fourier coefficients we approximate the integral by a sum. We use the simplest formula for the integral, where the function is approximated as a number of rectangles of height fm and width h (the sampling interval). In this case we get:

So we find for a discrete function fm the Fourier series is:

where the Fourier coefficients are given by:

This is the Discrete Fourier Transform, or Discrete Fourier Series.

The values given for the Fourier coefficients will agree with those calculated for the original continuous function as long as the sampling interval has been chosen correctly and we have an exact number of sample intervals within a single period. We can use this fact to check that the values found from the discrete calculation agree with those found for the original continuous function. Remember the relationship between the Fourier coefficients in the Complex form of the Fourier Series and the Fourier coefficients for the trigonometric form. The trigonometric series is expressed by:

The amplitude and phase form of the Fourier series is:

The relationship with the complex coefficients is given by:

For a real function of t the negative frequency Fourier coefficients are the complex conjugates of the positive frequency coefficients and therefore are not displayed by plotXpose.

A straight forward calculation of the Discrete Fourier Transform would involve N*N operations and would be very slow. Fast Fourier Transform algorithms speed up the calculation by using factorization. The number of operations then depends on N multiplied by the sum of the factors of N, usually a much smaller number than N *N.

plotXpose also makes use of the fact that the original function of t is real in order to half the number of calculations. It will always make the number of points used in the Fourier Transform even and then factorizes the half number of points into its prime factors. For instance by default t is defined for the range -5<=t<5 with a sampling interval of 0.1 giving (5-(-5))/0.1 points =100. As 100=2*(2*5*5) then the number of operations involved in the transform is related 100*(2+5+5). This algorithm will not be fast if half the number of points happens to be prime.

The vertical axis represents amplitudes or phase values. When the Fourier Transform is first calculated the range is calculated from the maximum and minimum values found for the amplitude spectrum or phase. To change the amplitude range tap the Settings icon on the Frequency tab. This will produce the "Amplitude Range" window displaying the current minimum and maximum displayed values for the amplitude or phase. Enter new values and select OK. The drawing is re-displayed using the new axis limits.

The frequency-axis range is always set from 0 to 1/(2*sampling interval). Negative frequency values are not displayed.

1 Chapter 5 of Mathematics for Electrical Engineering and Computing discusses Trigonometric functions and waves and see Page 94 for Amplitude, fundamental period, phase and cycle rate.

2 Chapter 16 of Mathematics for Electrical Engineering and Computing discusses Fourier Series.

#plotxposemenu

plotXpose app is available on Google Play

Google Play and the Google Play logo are trademarks of Google LLC.

Versions will shortly be available for iOS and Windows.

Google Play and the Google Play logo are trademarks of Google LLC.

Versions will shortly be available for iOS and Windows.

plotXpose app is a companion to the book Mathematics for Electrical Engineering and Computing by Mary Attenborough, published by Newnes, 2003.