slight difference in magnitude of signal between time and frequency domain
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2016-8-9
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 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!