When you want to transform time-domain data into the frequency domain, use the FFT block.
In this example, you use the Sine Wave block to generate two sinusoids, one at 15 Hz and the other at 40 Hz. You sum the sinusoids point-by-point to generate the compound sinusoid
Then, you transform this sinusoid into the frequency domain using an FFT block:
The FFT Example opens.
Amplitude = 1
Frequency = [15 40]
Phase offset = 0
Sample time = 0.001
Samples per frame = 128
Based on these parameters, the Sine Wave block outputs two sinusoidal signals with identical amplitudes, phases, and sample times. One sinusoid oscillates at 15 Hz and the other at 40 Hz.
Double-click the Matrix Sum block. The Block Parameters: Matrix Sum dialog box opens.
Because each column represents a different signal, you need to sum along the individual rows in order to add the values of the sinusoids at each time step.
Double-click the Complex to Magnitude-Angle block. The Block Parameters: Complex to Magnitude-Angle dialog box opens.
This block takes the complex output of the FFT block and converts this output to magnitude.
Click the Scope Properties tab.
Input domain = Frequency
Click the Axis Properties tab.
Frequency units = Hertz (This corresponds to the units of the input signals.)
Frequency range = [0...Fs/2]
Select the Inherit sample time from input check box.
Amplitude scaling = Magnitude
The scope shows the two peaks at 15 and 40 Hz, as expected.
You have now transformed two sinusoidal signals from the time domain to the frequency domain.
Note that the sequence of FFT, Complex to Magnitude-Angle, and Vector Scope blocks could be replaced by a single Spectrum Analyzer block, which computes the magnitude FFT internally. Other blocks that compute the FFT internally are the blocks in the Power Spectrum Estimation library. See Spectral Analysis for more information about these blocks.