if the number of samples for doing fft is not n power of 2 the results accuracy would be affected?
2 views (last 30 days)
Show older comments
Hi everyone! I haved been reading that matlab can perform fft when the length of the signal is not n power of 2 but I want to know if that would affect the accuracy of the results. Thanks in advance!
0 Comments
Answers (1)
Walter Roberson
on 23 Jun 2017
Every change to algorithm affects the accuracy of floating point calculations. But the accuracy is not necessarily worse.
Keep in mind that on Intel processors, sufficient large fft might get handled by calling Intel's highly-optimized MKL (Math Kernel Library), so the accuracy might change for large enough matrices, on some platforms.
In some x64 systems (many) there is a single-instruction Fused Multiply and Add, that does (A*x+B) in a single instruction. This can reduce instruction decoding, especially in its vectorize VX and VX2 SIMD forms, so it can be faster. But it has a different accuracy than doing ((A*x)+B) because when you do a fused operation, the full internal precision of the multiplication is retained for the addition. Multiplication of double precision operands might be done with 80 bit words internally in order to meet ULP (Unit In the Least Place) precision requirements. IEEE 754 requires that when internal registers longer than the explicit length are used, that calculations be done as if the calculation were stored to memory each time, rounding back to 64 bits. The fused form of the instruction does not necessarily do that rounding between the instructions. Therefore if the fused form is used then the accuracy will change. The accuracy might be higher from a theoretical standpoint. Or not.
In floating, whether you calculate ( (A + B) + C ) or (A + (B + C)) changes the accuracy of the result. That doesn't mean one is better than the other: you can construct situations where either is "better".
0 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!