Obtain Power Spectrum from Voltage Timeseries

I want to obtain Power spectrum of the Voltage Timeseries of Vela Pulsar data given in picture below :thinking:

How should i implement FFTW ?

Does DSP.welch_pgram or DSP.periodogram help you?

No , i want to do it using FFTW but its documentation is not having examples. What should i do ?

I think FFTW.jl should have more elaborate documentation with example because fft is very useful . :wink:

How to find the DFT of a time series using FFTW:

using FFTW: fft, fftshift, fftfreq

data = ... # your data here
fs = ... # specify sampling frequency here

# frequencies where the DFT is evaluated:
f_range = fftshift(fftfreq(data, fs))

# DFT of data
data_f = fftshift(fft(data))

Using fftshift is optional, but it will sort f_range in ascending order, which is nice.

using DelimitedFiles,Plots ,PlutoUI,HypothesisTests,Statistics,FFTW
M = readdlm(f);
@bind data Slider(1000:1000:50000, default=10000)
M[1:data:end, 1]
g=fftshift(fft(M[1:data:end, 1]),125000)

g=fftshift(fft(M[1:data:end, 1]),125000)

:thinking: is it correct ? Where 125000 is sampling frequency.

You’ve been pointed to this before, but as a reminder please read your older posts.

1 Like