[ncl-talk] PSD vs. Frequency plot ...

Dennis Shea shea at ucar.edu
Wed Aug 17 11:37:06 MDT 2016


 x(t) - data values as a function of time
    N - number of time steps

f      - frequency
df    - frequency interval , f-df/2 to f+df/2
A(f) - periodgram estimates (FFT); amplitudes at each frequency .
         FFTs have some normalization associated with them (eg: 1/N)
k     - wave number
A(k) = A(1/f)

Periodogram:  P(k) = A^2(k)/2
Total_Power = SUM[ A^2(k) ]/2

Power Spectral Density (PSD) :
                                     The density of power in the interval
'df'

===
There is an undocumented function in 'shea_util.ncl.' This does everything
the builtin function 'specx_anal' does. It illustrates the spectral
analysis process step-by-step.

function SPECX_ANAL(X[*]:numeric, iopt[1]:integer, jave[1]:integer,
pct[1]:numeric)

You can see the function via:

%> less "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util"

or, use an editor (say, vi) to extract the code and make a local function

   SPECX_ANAL -> SPECX_UFUK

You can then change whatever you want.

---
I wrote a draft, then found the following and modified it a bit:
   http://th-www.if.uj.edu.pl/zfs/gora/timeseries09/lecture02.pdf

On Wed, Aug 17, 2016 at 1:36 AM, Ufuk Utku Turuncoglu (BE) <
u.utku.turuncoglu at be.itu.edu.tr> wrote:

> Hi,
>
> I just wonder that is there any exampleNCL script to plot time series in
> PSD (Power Spectral Density) vs. Frequency? I know that there are some
> NCL functions such as specx_anal but it gives variance not PSD. FFT
> functions might be used but i am not sure. Any suggestion might help.
>
> Regards,
>
> --ufuk
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160817/b405dd8b/attachment.html 


More information about the ncl-talk mailing list