slight difference in magnitude of signal between time and frequency domain
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hi all,
this has been puzzling me for some time now and I would be thankful if you could lead me to the right direction of solving this.
I am reading a .wav file using audioread() and saving the samples in a vector y. I am then multiplying the samples in y by a factor of 1.18 in order to bring them to a desired level.
I am then running y through the following function:
NFFT = 2^nextpow2(length(y)); %improves performance of fft
Y = (1/NFFT)*fft(y,NFFT); %multiply by 1/NFFT to compensate matlab scaling...
freqAxis = fs/2*linspace(0,1,NFFT/2); %construct the frequency axes
Y = 2*Y(1:(NFFT/2)); %keep the first half of the data, multiply by 2 to compensate for lost energy
When I am checking the max(y) then I get the expected value of 1.18. When I am checking the maximum of the frequency representation of y by using max(abs(Y)) then i am getting a value of about 0.97.
This creates big problems to my application as the plot of the fft always returns with a few dBs of error as compared to the real magnitude of the signal.
I wonder if there is something wrong with my implementation or if I am totally missing something here.
thank you for your time, Dimitris
0 Commenti
Risposta accettata
Star Strider
il 9 Ago 2016
This is incorrect:
Y = (1/NFFT)*fft(y,NFFT); %multiply by 1/NFFT to compensate matlab scaling...
Divide by the length of the original signal, not the padded signal to correct for the energy in the signal. Scaling has nothing at all to do with it. See the R2015a documentation for fft for details. That documentation should answer your other questions as well.
0 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Digital Filter Analysis 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!