MATLAB: Does the combination of FFT and IFFT blocks return an unexpected result when used with fixed-point values in Signal Processing Blockset 6.2 (R14SP3)

When I combine the FFT and IFFT blocks in Simulink 6.3 (R14SP3), I expect to obtain at the output a signal equal to the input. When the values being processed have a fixed-point type, the output is significantly different than the input. Refer to the attached model for reference.

Best Answer

The reason why output values of IFFT do not match input values of FFT is because unacceptable precision loss happens during fixed-point computation of FFT and IFFT. This is caused by the user's fixed-point data type setting on the fixed-point tabs of FFT and IFFT block.
The following helps verify that the fixed-point algorithm works fine.
1. Open the model
2. Select 'Fixed-point Settings' under 'Tools'
3. Select 'Min,max and overflow' for Logging mode and 'True doubles' for Data type override.
4. Run the model simulation
Note that the output matches the input exactly. In minmax logging mode, the floating-point algorithm behaves in exactly the same way as the fixed-point algorithm.
As documented, the Sine table is PURE FRACTIONAL, i.e., the fraction length of the sine table values is always equal to the word length minus one.
However, if
1. The model settings make accumulator, product output and output of FFT and IFFT block pure integers (int16).
2. The input is also int16 with values of real or imag part -1, 1 or 0.
Then, when the input mutiplies the sine table value and is casted to the accumulator data type (int16), a considerable loss of precision occurs because all fractional parts are ignored.
To get high precision fixed-point output, it is necessary to tune the parameters on the fixed-point tab.
In order to obtain a satisfactory result with fixed-point calculations: (See attached model fft_test_1b.mdl)
1. Open the model, in 'configuration parameters', select 'hardware implementation', set Device type as 'ASIC/FPGA', click 'OK' to save the change.
2. Use the following settings for FFT and IFFT block:
- Select 'inherit via internal rule' for product output and accumulator data types.
- Set FFT output data type as word length 32 and fractional length 15.
- Set IFFT output data type 'Same as input'.
3. Run the model simulation
4. Define the error as 'yin1-yout1'. plot the error and you will see the error is within tolerance (same order as 2^-15=3.0518e-5, i.e., maximum resolution of sine table value)
figno = figure(1);
subplot(2,1,1), plot(real(yin1-yout1));
ylabel('real(error)');
subplot(2,1,2), plot(imag(yin1-yout1));
ylabel('imag(error)');