DSPRelated.com
Forums

PSD from FFT.

Started by raj malhotra August 20, 2010
Hi,
I have (Amplitude,Time) curve and i want to plot the PSD in frequency
domain.
So i want (PSD,frequency).

I am calculating PSD using FFT as follows:

(|FFTmag|^2)/(N*Delta_F)


Here :
 FFTmag :  Magnitude of FFT of amplitude parameter.  
 N      :  Number of points in the Amplitude parameter .
 Delta_F:  The sampling interval, the difference between the first two
           points in the Time parameter. 

The PSD plot i'm getting is not satisfactory. Kindly pour in !

Thanks & Regards,
Raj!

On Aug 20, 2:30&#4294967295;am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits-
goa.ac.in> wrote:
> Hi, > I have (Amplitude,Time) curve and i want to plot the PSD in frequency > domain. > So i want (PSD,frequency). > > I am calculating PSD using FFT as follows: > > (|FFTmag|^2)/(N*Delta_F) > > Here : > &#4294967295;FFTmag : &#4294967295;Magnitude of FFT of amplitude parameter. &#4294967295; > &#4294967295;N &#4294967295; &#4294967295; &#4294967295;: &#4294967295;Number of points in the Amplitude parameter . > &#4294967295;Delta_F: &#4294967295;The sampling interval, the difference between the first two > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;points in the Time parameter. > > The PSD plot i'm getting is not satisfactory. Kindly pour in ! > > Thanks & Regards, > Raj!
So you had a concept and your implementation of it failed. If you have a question about your implementation, you need to tell us about your implementation. What spectral density did you use for this calculation? What is the scaling convention of your fft implementation? What is the PSD plot that you calculated? Why do you think it is not satisfactory? Kindly pour out ! Dale B. Dalrymple
On Aug 20, 5:30&#4294967295;am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits-
goa.ac.in> wrote:
> Hi, > I have (Amplitude,Time) curve and i want to plot the PSD in frequency > domain. > So i want (PSD,frequency). > > I am calculating PSD using FFT as follows: > > (|FFTmag|^2)/(N*Delta_F) > > Here : > &#4294967295;FFTmag : &#4294967295;Magnitude of FFT of amplitude parameter. &#4294967295; > &#4294967295;N &#4294967295; &#4294967295; &#4294967295;: &#4294967295;Number of points in the Amplitude parameter . > &#4294967295;Delta_F: &#4294967295;The sampling interval, the difference between the first two > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;points in the Time parameter. > > The PSD plot i'm getting is not satisfactory. Kindly pour in !
Why do you think it is not satisfactory? A quantity that varies like time, amplitude, frequency and PSD is not a parameter; it is a variable. Delta _F should be remaned Delta_T ("T"ime, not "F"requency) it is the reciprocal of the sampling rate Fs. The correct formula is PSD = (|FFTmag|^2)/(N*Fs) Hope this helps. Greg
On Aug 20, 9:08&#4294967295;am, Greg Heath <he...@alumni.brown.edu> wrote:
> On Aug 20, 5:30&#4294967295;am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits-
> > Hi, > > I have (Amplitude,Time) curve and i want to plot the PSD in frequency > > domain. > > So i want (PSD,frequency). > > > I am calculating PSD using FFT as follows: > > > (|FFTmag|^2)/(N*Delta_F)
...
> > Here : > > &#4294967295;FFTmag : &#4294967295;Magnitude of FFT of amplitude parameter. &#4294967295; > > &#4294967295;N &#4294967295; &#4294967295; &#4294967295;: &#4294967295;Number of points in the Amplitude parameter .
.> > &#4294967295;Delta_F: &#4294967295;The sampling interval, the difference between the first two .> > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;points in the Time parameter. ...
> > The PSD plot i'm getting is not satisfactory. Kindly pour in !
> ... > The correct formula is > > PSD = (|FFTmag|^2)/(N*Fs)
While the OP's syntax leaves something to be desired and the definition of Delta_F should say difference in frequency instead of time, the OP's formula is correct with Delta_F. (For a rectangular window.) The correct units of PSD are (amplitude units)^2/Hz. See the table on page 38 of the article starting on page 26 of: http://www.bksv.com/doc/bv0031.pdf and the rest of the article for a discussion on the appropriate units for spectrum analysis. Still waiting for answers from the OP to pour out ! Dale B. Dalrymple
On Aug 20, 6:51&#4294967295;pm, dbd <d...@ieee.org> wrote:
> On Aug 20, 9:08&#4294967295;am, Greg Heath <he...@alumni.brown.edu> wrote: > > > On Aug 20, 5:30&#4294967295;am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits- > > > Hi, > > > I have (Amplitude,Time) curve and i want to plot the PSD in frequency > > > domain. > > > So i want (PSD,frequency). > > > > I am calculating PSD using FFT as follows: > > > > (|FFTmag|^2)/(N*Delta_F) > ... > > > Here : > > > &#4294967295;FFTmag : &#4294967295;Magnitude of FFT of amplitude parameter. &#4294967295; > > > &#4294967295;N &#4294967295; &#4294967295; &#4294967295;: &#4294967295;Number of points in the Amplitude parameter . > > .> > &#4294967295;Delta_F: &#4294967295;The sampling interval, the difference between the > first two > .> > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;points in the Time parameter. > ... > > > > The PSD plot i'm getting is not satisfactory. Kindly pour in ! > > ... > > The correct formula is > > > PSD = (|FFTmag|^2)/(N*Fs) > > While the OP's syntax leaves something to be desired and the > definition of Delta_F should say difference in frequency instead of > time, the OP's formula is correct with Delta_F. (For a rectangular > window.) > The correct units of PSD are (amplitude units)^2/Hz.
If the coefficient in front of the sums are 1 and (1/N) for the DFT and IDFT, respectively, then my equation with Fs in the denominator is correct. Beware, however, that some of the several MATLAB functions that calculate PSD only have N in the dominator (presumably they use frequency normalized so that Fs = 1). Since Fs = N*Delta_F, if FFT = (1/N)*sum(...) then PSD = (N^2*|FFTmag|^2)/(N*N*Delta_F) = (|FFTmag|^2)/(Delta_F) whereas if FFT = (1/sqrt(N))*sum(..) then PSD = (N*|FFTmag|^2)/(N*N*Delta_F) = (|FFTmag|^2)/(N*Delta_F) as quoted by the OP. All three formulae have the same dimensions. Therefore, it all depends on which FFT scaling is in use. Hope this helps. Greg
On Aug 20, 11:38&#4294967295;pm, Greg Heath <he...@alumni.brown.edu> wrote:
> > ... > Hope this helps. >
It helps that your Delta-T and its units are gone. As to scaling, we need the OP to let the language/library used and any other detail pour out ! Dale B. Dalrymple
On Aug 23, 2:56 am, dbd <d...@ieee.org> wrote:
> On Aug 20, 11:38 pm, Greg Heath <he...@alumni.brown.edu> wrote: > > ... > > Hope this helps. > > It helps that your Delta-T and its units are gone.
1. I never used Delta_T in a formula. 2. All of my formulas were correctly dimensioned.
> As to scaling, we > need the OP to let the language/library used and any other detail pour > out !
Agee. Greg Heath
Hi, 
Firstly, Whatever you may name it , Delta_T or Delta_F , I meant it the
difference in time at first two points. 

Secondly, by saying "the results are not satisfactory", i meant that the
output graph "basic shape" which i'm getting is matching with the results
expected, but the results I'm getting are not "exact", so there must be a
"scaling problem" as far as i think. But i don't know what scaling factor
should i use! 

You have suggested a factor of "3D" in your formula, what is "D" there? 
I assure you that the implementation which i have done is correct as i have
calculated many things apart from psd and i'm successful in those. 

I know it may not be a very appropriate thing to ask for scaling factor
since it is a kind of "user dependent" or custom made thing, still if you
have some suggestion, i thank you in advance!

Thanks & Regards,
Raj!
On Aug 25, 1:54&#4294967295;am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits-
goa.ac.in> wrote:
> Hi, > Firstly, Whatever you may name it , Delta_T or Delta_F , I meant it the > difference in time at first two points. >
"Delta_F" is a curious nomenclature for a difference in time. (The choice between Delta_F and Delta_T is also a scaling factor.)
> Secondly, by saying "the results are not satisfactory", i meant that the > output graph "basic shape" which i'm getting is matching with the results > expected, but the results I'm getting are not "exact", so there must be a > "scaling problem" as far as i think. But i don't know what scaling factor > should i use!
Different implementations in different libraries or languages make different assumptions about scaling. Some scale in the FFT, some in the IFFT and some split the scaling into both FFT and IFFT. That's why we ask for the details. Without more detail, no one knows what scaling factor you should use.
> > You have suggested a factor of "3D" in your formula, what is "D" there? > I assure you that the implementation which i have done is correct as i have > calculated many things apart from psd and i'm successful in those.
Power spectrum is scaled differently from power spectral density, some FFT libraries are scaled for one, some for the other, some aren't right for either without additional scaling. That's why we ask about them.
> > I know it may not be a very appropriate thing to ask for scaling factor > since it is a kind of "user dependent" or custom made thing, still if you > have some suggestion, i thank you in advance!
Scaling factor is a common issue. Your initial post did not include enough detail to determine which, if any, of the many scaling issues you might face. That's why what you have been asked asked are the usual questions. Dale B. Dalrymple
On Aug 21, 4:08&#4294967295;am, Greg Heath <he...@alumni.brown.edu> wrote:
> On Aug 20, 5:30&#4294967295;am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits- > > > > goa.ac.in> wrote: > > Hi, > > I have (Amplitude,Time) curve and i want to plot the PSD in frequency > > domain. > > So i want (PSD,frequency). > > > I am calculating PSD using FFT as follows: > > > (|FFTmag|^2)/(N*Delta_F) > > > Here : > > &#4294967295;FFTmag : &#4294967295;Magnitude of FFT of amplitude parameter. &#4294967295; > > &#4294967295;N &#4294967295; &#4294967295; &#4294967295;: &#4294967295;Number of points in the Amplitude parameter . > > &#4294967295;Delta_F: &#4294967295;The sampling interval, the difference between the first two > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;points in the Time parameter. > > > The PSD plot i'm getting is not satisfactory. Kindly pour in ! > > Why do you think it is not satisfactory? > > A quantity that varies like time, amplitude, frequency and PSD > is not a parameter; it is a variable. > > Delta _F should be remaned Delta_T ("T"ime, not "F"requency) > it is the reciprocal of the sampling rate Fs. > > The correct formula is > > PSD = (|FFTmag|^2)/(N*Fs) > > Hope this helps. > > Greg
and it isn't PSD but an approximation called Periodogram. PSD is for analogue continuous time. Hardy