Precision of FFT function
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a fft function in C programming language. All inputs, window coefficients, twiddle factors and outputs are set to a precision 0f 6 digits. I wanted to make a reference output using Matlab. I used, vpa(fft(x),8) to round my output to 6 demical places, eg: 11.243127. I expected similar outputs, but there seems to be precision errors beyond my expectations. A sample is shown below:
C output: -17.119499+87.937943i
Matlab output: - 17.118454 + 87.935932i
Is there something that I missed out? The expected relative error is 0.00001
3 Commenti
dpb
il 19 Set 2023
C=-17.119499+87.937943i;
M=-17.118454 + 87.935932i;
C-M
"All inputs, window coefficients, twiddle factors and outputs are set to a precision 0f 6 digits..."
The observed differences are in 5th digit; about what I'd think best one could expect with carryover although you didn't indicate the length of the signal...
Paul
il 20 Set 2023
Instead of using vpa, probably better to use round if only care about the number digits after the decimal point, rather than the total number of significant figures. For example:
format long
round(100*pi,6)
In this call
vpa(fft(x),8)
what is the class of x? Is it double or single? And, is x rounded to six decimal digits? Or does is it have as many decimal digits as its class allows (I probably haven't worded that precisely, but hopefully the question is clear enough)?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!