if the number of samples for doing fft is not n power of 2 the results accuracy would be affected?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2017-6-23
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!