Documentation |
When you want to transform frequency-domain data into the time domain, use the IFFT 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, $$u=\mathrm{sin}\left(30\pi t\right)+\mathrm{sin}(80\pi t)$$. You transform this sinusoid into the frequency domain using an FFT block, and then immediately transform the frequency-domain signal back to the time domain using the IFFT block. Lastly, you plot the difference between the original time-domain signal and transformed time-domain signal using a scope:
At the MATLAB^{®} command prompt, type ex_ifft_tutex_ifft_tut.
The IFFT Example opens.
Double-click the Sine Wave block. The Block Parameters: Sine Wave dialog box opens.
Set the block parameters as follows:
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.
Save these parameters and close the dialog box by clicking OK.
Double-click the Matrix Sum block. The Block Parameters: Matrix Sum dialog box opens.
Set the Sum over parameter to Specified dimension and the Dimension parameter to 2. Click OK to save your changes.
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 FFT block. The Block Parameters: FFT dialog box opens.
Select the Output in bit-reversed order check box., and then click OK.
Double-click the IFFT block. The Block Parameters: IFFT dialog box opens.
Set the block parameters as follows, and then click OK:
Select the Input is in bit-reversed order check box.
Select the Input is conjugate symmetric check box.
Because the original sinusoidal signal is real valued, the output of the FFT block is conjugate symmetric. By conveying this information to the IFFT block, you optimize its operation.
Note that the Sum block subtracts the original signal from the output of the IFFT block, which is the estimation of the original signal.
Set the block parameters as follows, and then click OK:
Click the Scope Properties tab.
Input domain = Time
The flat line on the scope suggests that there is no difference between the original signal and the estimate of the original signal. Therefore, the IFFT block has accurately reconstructed the original time-domain signal from the frequency-domain input.
Right-click in the Vector Scope window, and select Autoscale.
In actuality, the two signals are identical to within round-off error. The previous figure shows the enlarged trace. The differences between the two signals is on the order of 10^{-15}.