Power Spectral Density of a Signal in decibels
Show older comments
Hello,
I am calculating the Power Spectral Density of a signal using fft as recommended in the matlab demo section. I would like to display the fft analysis in the same manner as you would see on a third octave band analyser sound level meter.
I have the following code:
M1Afft = fft(M1A,length(M1A));
PowM1Afft = M1Afft.*conj(M1Afft)/length(M1A);
plot(f,PowM1Afft(1:length(M1A)))
axis([0,2000,0,1.5])
title('Measurement 1')
xlabel('Frequency (Hz)')
I am unsure of the Y axis units, but i would like them in decibels based on sound power of the frequency. I am also having a quite a bit of problems getting a histogram to produce frequency bins in the manner of a third octave band analyser.
Any help would be greatly appreciated.
Many Thanks, Andy
Accepted Answer
More Answers (1)
Wayne King
on 13 Dec 2011
If you want to do the above with just fft()
xdft = fft(x);
% even length x
psdest = abs(xdft(1:length(xdft)/2+1)).^2;
psdest = (1/(Fs*length(x))).*psdest;
psdest(2:end-1) = 2*psdest(2:end-1);
xdft = (1/(Fs*length(x))).*xdft;
f = 0:Fs/length(x):Fs/2;
plot(f,10*log10(psdest)); grid on;
3 Comments
Andy
on 13 Dec 2011
Andy
on 13 Dec 2011
Wayne King
on 13 Dec 2011
It just means you have less than 1 (but greater than 0)
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!