필터 지우기
필터 지우기

slight difference in magnitude of signal between time and frequency domain

조회 수: 2 (최근 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

채택된 답변

Star Strider
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.

추가 답변 (1개)

Dimitris
Dimitris 2016년 8월 9일
thank you very much for your input. this fixes my problem!

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by