Use nufft in stft - Non-uniform sampling for use in spectrogram for a time-series analysis

18 ビュー (過去 30 日間)
mack
mack 2023 年 2 月 2 日
コメント済み: mack 2024 年 4 月 17 日
Hello,
I have a time series analysis, that samples from something every T milliseconds. However, sometimes the measurement fails, and so I am (often) missing samples (sometimes several, or many in a row). I would like to create a spectrogram for this signal, and as such I need to perform a short-time Fourier transform on this data, which has non-uniform sampling.
I see there is a NUFFT function for non-uniform discrete fourier transforms (https://ch.mathworks.com/help/matlab/ref/double.nufft.html),
and also the STFT function for windowing the data into sections and performing a discrete Fourier transform on each section (https://ch.mathworks.com/help/signal/ref/stft.htm).
My question is whether I need to do my own windowing and STFTs with the NUFFT function in order to use non-uniformly sampled data in the STFT, or whether there is a better strategy or ideally a built-in function which allows me to do this.
Thank you for your help!
  2 件のコメント
Charlotte
Charlotte 2024 年 4 月 17 日
Hi! Have you find a solution for this problem? Thanks!
mack
mack 2024 年 4 月 17 日
Hello,
Nothing particularly satisfying but something that at least works. I had to do a bunch of other work before resolving this 100%, but in the interim there is just one (as far as I know) matlab function which can handle very irregularly spaced data:
pspectrum(samples, sample_times, 'spectrogram');
With this you can specify the specific time at which each sample was measured.

サインインしてコメントする。

回答 (1 件)

Vilnis Liepins
Vilnis Liepins 2023 年 2 月 6 日
Hi mack,
As an alternative approach to 'nufft' you can try 'edft' function available on fileexchange Extended DFT - File Exchange - MATLAB Central (mathworks.com). Its application is quite simple - replace the missing samples with NaN and run: edft(your_data_with_NaN). In case your data doesn't have NaNs, 'edft' will apply Matlab's 'fft' function. Hope this helps!
  1 件のコメント
mack
mack 2023 年 2 月 8 日
編集済み: mack 2023 年 2 月 8 日
This does not help, as there is nothing wrong with nufft. I need something that can perform the short-time version of this, including windowing, which your function does not do. Thanks for the help anyway.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime-Frequency Analysis についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by