Questions tagged [spectral-density]
63 questions
31
votes
2 answers
Fast Fourier Transform in R
I have a dataset with the number of hourly visits an animal made during a period of 12 months. I want to use the Fast Fourier Transform to examine cyclical patterns and periodicity. In the past, I have used Statistica for this this; however, I would…

user1626688
- 1,583
- 4
- 18
- 27
16
votes
3 answers
How to use the cross-spectral density to calculate the phase shift of two related signals
I've two signals, from which I expect that one is responding on the other, but with a certain phase shift.
Now I would like to calculate the coherence or the normalized cross spectral density to estimate if there is any causality between the input…

Mattijn
- 12,975
- 15
- 45
- 68
14
votes
3 answers
Power Spectral Density from jTransforms DoubleFFT_1D
I'm using Jtransforms java library to perform analysis on a given dataset.
An example of the data is as follows:
980,988,1160,1080,928,1068,1156,1152,1176,1264
I'm using the DoubleFFT_1D function in jTransforms.
The data output is as follows:…

Damon
- 718
- 2
- 8
- 22
7
votes
2 answers
Strategies for debugging numerical stability issues?
I'm trying to write an implementation of Wilson's spectral density factorization algorithm [1] for Python. The algorithm iteratively factorizes a [QxQ] matrix function into its square root (it's sort of an extension of the Newton-Raphson square-root…

Dan
- 5,763
- 3
- 17
- 13
5
votes
1 answer
Correct normalization of discrete power spectral density in python for a real problem
I am struggling with the correct normalization of the power spectral density (and its inverse).
I am given a real problem, let's say the readings of an accelerometer in the form of the power spectral density (psd) in units of Amplitude^2/Hz. I would…

Bene Gesserit
- 51
- 1
- 2
4
votes
1 answer
Unknown noise in density spectrum of a perfect sine wave
There's something I don't understand: I computes the spectral density of a signal (by computing its FFT) and that seems to work correctly but it keeps having some kind of background noise, although I'm doing it on a perfect sine wave with 2…

user978548
- 711
- 2
- 7
- 12
4
votes
1 answer
Prefactors computing PSD of a signal with numpy.fft VS. scipy.signal.welch
The power spectral density St of a signal u may be computed as the product of the FFT of the signal, u_fft with its complex conjugate u_fft_c. In Python, this would be written as:
import numpy as np
u = # Some numpy array containing signal
u_fft =…

Bremsstrahlung
- 686
- 1
- 9
- 23
4
votes
1 answer
Matlab/Python: Power spectral density of non-uniform time series
I am trying to find the power spectral density of a signal measured at uneven times. The data looks something like this:
0 1.55
755 1.58
2412256 2.42
2413137 0.32
2497761 1.19
...
where the first column is the time since the first measurement (in…

Daniel.Reardon
- 41
- 1
- 3
3
votes
1 answer
Power Spectral Density from Accelerometer data
I have an accelerometer data i.e. AccX, AccY and AccZ.
I am looking for an algorithm to compute Power Spectral Density from this data. I know the following:
F = fft (s);
where "s" is the input signal and fft is fast fourier transform.
PSD =…

VikramBishnoi
- 98
- 1
- 8
3
votes
1 answer
on the use and understanding of pwelch in matlab
I'm using the pwelch method in matlab to compute the power spectra for some wind speed measurements. So, far I have written the following code as an example:
t = 10800; % number of seconds in 3 hours
t = 1:t; % generate time vector
fs = 1; %…

Emma Tebbs
- 1,457
- 2
- 17
- 29
2
votes
0 answers
High pass filter with specific cut-off frequency
The situation
I am trying to apply a high pass filter to a black&white image to enhance the texture by keeping the high frequencies. The goal is to filter from a specific frequency value obtained from the outcome of applying signal.welch() from…

davipeix
- 55
- 7
2
votes
0 answers
Conversion from Matlab to Python of Cross Power Spectral Density function
I am trying to convert a MATLAB program to python. I am having problems setting up the cross power spectral density function and obtain matching results with Matlab.
The function used in the MATLAB code is written as follows:
[Pxy,f] =…

Francesca Marafini
- 21
- 1
2
votes
1 answer
Why does scipy.signal.welch suppress zero frequency?
I try to use whelch method and I found that zero frequency is abnormal
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
n = 100000
s = np.ones(n)
f, psd = signal.welch(s, return_onesided=False)
plt.plot(f,…

Sergey Bakhurin
- 53
- 4
2
votes
2 answers
power spectral density from fft result c#
I have a Complex[] (from CsCore) which is the result of my FFT.
Complex has a float real and a float imaginary.
From this I calculated the following
Frequency: (double)index * sampleRate / FftSize;
Amplitude / Magnitude: Math.Sqrt(Math.Pow(real,…

Gert Kommer
- 1,163
- 2
- 22
- 49
2
votes
1 answer
Using pwelch to a set of signals: some questions (Matlab)
I would like to use pwelch on a set of signals and I have some questions.
First, let's say that we have 32 (EEG) signals of 30 seconds duration. The sampling frequency is fs=256 samples/sec, and thus each signal has length 7680. I would like to use…

nullgeppetto
- 539
- 1
- 8
- 25