# Power Spectrum in dBFs

I'm trying to get the spectrum of my signal in dBFS units. I'm not sure what is the refernce that I should devide by. I computed the power spectrum as follows:

1) FFT normalized to the number of samples

p = abs(fft(signal))/(No_of_samps/2);


2) and then I calculated the power spectrum for half of the samples (one-sided)

p = p(1:Nsamps/2).^2;


3) I tried to represent it in dBFS as follows:

p_dBFs = 10*log(abs(p)/(vref/2)^2);


Where vref is my reference p-p voltage in the ADC.

I'm just not sure whether I should devide by the reference voltage to get values in dBFS, like when I apply a FS signal I would like to see the highest peak in the spectrum at exactly 0 dBFs.

Note: The time-domain signal is also multiplied by a hamming window before computing the FFT.

Any help is appreciated.

Sorry for the long post. Thank you guys very much.

Hello again guys after a lot of thought, I finally broke this down and I would like to share it with you hoping it'll help.

So what I did was:

1- I used matlab's pwelch to get the power spectrum like this

[AutoPowerSpectrum ,F] = pwelch(signal, Nsamps, 0, Nsamps, fs, 'power');


you can read about the different parameters for pwelch in matlab's documentation right HERE.

2- I calculated Vpeak squared, because as far as I know pwelch produces Vrms values.

AutoPowerSpectrum = 2.*AutoPowerSpectrum;


3- got the Vpeak by squaring the above equation

AutoPowerSpectrum = sqrt(AutoPowerSpectrum);


4- converted it to dBFs

p_dBFs = 20*(log10(AutoPowerSpectrum./(vPerLevel*2^(N-1))));


where: vPerLevel is the voltage corresponding to each level in my ADC. It is calculated like this Vref/2^N.

and N is the resolution of the ADC.

Finally used plot() to display it. This solution worked with me and gave me the signal in dBFS, i'm opened to edits and suggestions.

Hope this helped.

Cheers.