Published: February 06, 2020 |

Len Gasior, Product Support Engineer, dSPACE Inc.

Back in the 90s, there was this great song called “Time” by Hootie & the Blowfish, which is essentially about the passing of time in one’s life. It contains the powerful line, “Time… why you punish me”. As engineers, we often use the time domain as the main method to analyze the signals of our application and this is usually sufficient for our purpose. However, there are situations where using the time domain is not suitable, for example when attempting to analyze signal mixtures which can be very frustrating leaving one to cry out in frustration “Time…why you punish me!”.

Since it’s critical to be able to analyze our applications properly or alternatively risk failure due to mixed signal analysis, it’s essential to use the frequency domain and a method known as FFT.

Time vs. frequency domain

In real world applications, we often have to contend with a mixture of signals consisting of various frequencies, as well as noise and crosstalk, coupled to the signals we truly want to use or care about. Analyzing these signals in the time domain can pose a challenge since they cannot be easily differentiated. The technique to handle this situation is called Fast Fourier Transform or FFT.

Simply stated, FFT is an algorithm that computes a signal from the time domain to a representation in the frequency domain. When FFT is employed on a mixed signal, the bundle is deconstructed and displayed in a plot where one can identify each signal based on its frequency.

With that being said, the goal of this article isn’t to teach the concept of FFT, but to demonstrate its implementation to observe them in the frequency domain using dSPACE ControlDesk (yay!). As an added bonus, the implementation necessary doesn’t require you to perform any complex math (double yay!).

Signal Display in Timer Plotter Instrument

Before we get into the model implementation details, let’s review ControlDesk briefly. ControlDesk is the universal dSPACE experiment software. It provides numerous instruments to display signals and capture data. Out of the many instruments, ControlDesk contains the time plotter instrument, which does a great job of displaying and capturing signal values with respect to time. The visualization of signals in the time domain works well with clean signals, as seen the example.

Multiple signals in time domain

However, more often than not, applications can include many different frequency components within a signal profile, as well as mechanical and electrical noise. For example, in waveforms that are the sum of multiple signals of different frequencies, the time plotter will display a mixed bundle.

This mixed signal bundle is a combination of three sinewaves and from the plot provided in the example "Multiple signals in time domain"; it is difficult to distinguish between the three. Since the time plotter is not designed for displaying signals in the frequency domain, we need a better way. This is where the use of FFT becomes invaluable.

Typically, to deconstruct a mixed signal bundle, an oscilloscope with FFT capability can be used. From there, you can differentiate the multiple signals and proceed to design the appropriate filter. Using another piece of hardware for signal analysis is fine. However, an oscilloscope may not be available or can be inconvenient. In this case, you are in luck. There is a nifty model implementation that will allow you to display this signal bundle in ControlDesk. For this purpose, we must use the table editor instrument.

The table editor instrument is a powerful instrument that is used mainly to display table data such a maps and curves.

The table editor instrument

Multiple signals displayed in frequency domain

With a proper implementation of the model that involves using Simulink’s® FFT block and additional logic... voilà! The same signals as seen in the example image "Multiple signals in time domain" are transformed and displayed in the frequency domain within the table editor instrument.

The frequency domain display of represents the three signals as three distinct peaks, allowing you to clearly differentiate the signals frequencies. Yes, I know what you are thinking: "This is awesome!!!" and "How do I do this?". As the cliché goes, the devil is in the details.

As you can expect, a little effort is required to make this work. However, don’t worry. It is truly a little bit of effort on your part since most of the work has been done and shared with you here. So let’s take a look at how we can implement FFT in the model. To accomplish our goal, the model must provide a vector signal for both for the FFT calculation result and the frequency values (abscissa). To do this, you will have to add the following Simulink® blocks: Add a buffer, FFT, Gain (2), Constant (2), Complex to Magnitude-Angle and Pad (optional) to the model and connect them to the incoming signal source.

The model implementation for FFT

Next, the blocks can be parameterized as follows:

- Buffer > for 1,024 samples
- Gain 1 > value of 2
- Gain 2 > 1/1,024
- Constant 1 > 500 (if used)
- Freq. Vector (Constant) > 0 to 1,023

The Simulink® Pad block (connected to a constant) functions to generate a single-sided plot, instead of a traditional double-sided plot, and can be added, if desired. The frequency vector is simply a constant block connected to a terminator and is parameterized, based on number of FFT points. In this case, 1,024 (0 to 1,023) is provided to the 1,024 frequency bins of the abscissa. After building the model and loading the application in ControlDesk, you can apply the frequency vector and FFT result (from the Pad block or Complex to Magnitude block) to the table editor Instrument, as seen in the two images below.

Adding frequency Vector to the X axis

Adding FFT result to the Y-axis

When you take the application online in ControlDesk, you will observe the effect and glory of the FFT result in the frequency domain.

FFT result displayed in ControlDesk

So there you have it: A clever model implementation and instructions on how to display signals in the frequency domain using ControlDesk. With the ability to display signals in the frequency domain using ControlDesk, you are not only empowering yourself to test your applications with greater ease, but you are able to reduce the use of additional tools. Lastly, as a side benefit, you now no longer have to cry, “Time... why you punish me!” and can just enjoy the great music.

Drive innovation forward. Always on the pulse of technology development.

Subscribe to our expert knowledge. Learn from our successful project examples. Keep up to date on simulation and validation. Subscribe to/manage dSPACE direct and aerospace & defense now.