将时间戳转换为matlab fft可用形式? [英] Transforming timestamps into matlab fft usable form?

查看:156
本文介绍了将时间戳转换为matlab fft可用形式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我有以下时间戳的检测时间低于数万还有数万个未发布。

我很想知道如何将这些数字转换成matlab FFT函数可用形式,以便我可以找到期间信号。请帮助这位初学者吧!





Hi all! i have the following timestamps of detection time below and tens of thousands more not not posted.
I am dying to know how to transform these numbers into a matlab FFT function usable form so that i can find the period of the signal. Pls help out this beginner here!


82473035994223.000000
82473036321275.000000
82473036758714.000000
82473037152621.000000
82473037463611.000000
82473037735504.000000
82473038019083.000000
82473038281295.000000
82473038636703.000000
82473039013925.000000
82473039348376.000000
82473039596255.000000





我想到的是这个,通过给出时间戳a值为1,并尝试用值0填充中间时间。但我不知道如何实现填充0之间的中间位置以及如何将其放入fft中的操作。请指教!





What i have thought of is this, by giving the timestamps a value of 1, and trying to fill out the in betweens times with values of 0. But i do not know how to implement the action of filling out the in betweens with 0 and how to put it into the fft. pls advise!

82473035994223.000000    1
82473036321275.000000    1
82473036758714.000000    1
82473037152621.000000    1
82473037463611.000000    1
82473037735504.000000    1

推荐答案

我是不确定它是否实用,但是一种生成向量的方法,其中数据位置为1,其他位置为0如下所示:

I'm not sure it is practical, but a way to generate a vector where there's a 1 at the data positions and 0 everywhere else would be something like:
rawTimes = [82473035994223.000000
82473036321275.000000
82473036758714.000000
82473037152621.000000
82473037463611.000000
82473037735504.000000
82473038019083.000000
82473038281295.000000
82473038636703.000000
82473039013925.000000
82473039348376.000000
82473039596255.000000
# etc.];
reducedTimes = fix(rawTimes .- rawTimes(1));  # shift the absolute times to be INTEGER offsets
eventData = zeros(1, 1+reducedTimes(end));
eventData(1+reducedTimes) = 1;
# now you can fft(eventData);



这个 eventData vector可能是 HUGE


This eventData vector will likely be HUGE.


只需将其放入带有秒的向量中(将任何内容转换为秒,进行第一次)样本为零并从那里增加,换句话说,规范化你的值)并将数据分解成块,你可以在它上面做一个 fft()。该块的光谱分辨率等于fs / N,其中fs是采样频率,N是块大小(fft例程将根据传递给它的块大小选择fft大小,使用2 ^ N数字)。
Just put it in a vector with seconds (transform whatever that is to seconds, make the first sample be zero and increase from there, in another words, normalize your values) and break up the data into blocks and you can do an fft() on it. The block will have a spectral resolution equal to fs/N, where fs is the sampling frequency and N is the block size (the fft routine will pick the fft size based on the block size that you pass to it, using a 2^N number).


更多地考虑它,我不确定你真的需要使用FFT。

如果你只想要最好的近似期信号,那么也许你应该使用线性回归。

使用类似的东西:

Thinking about it more, I'm not sure you really need to use an FFT.
If you just want the best approximation to the period of the signal, then maybe you should use Linear Regression.
Use something like:
rawTimes = [82473035994223.000000
82473036321275.000000
82473036758714.000000
82473037152621.000000
82473037463611.000000
82473037735504.000000
82473038019083.000000
82473038281295.000000
82473038636703.000000
82473039013925.000000
82473039348376.000000
82473039596255.000000
# etc.];
X = rawTimes .- rawTimes(1);  # unlike Solution 1, these no longer need to be integer
Y = 1:(size(X)(1));
fit = polyfit(X, Y', 1);
period = 1./fit(1);



期限最合适,时间戳单位,事件之间的间隔

这12个点的期限约为325441.8


period is the best fit, in timestamp units, of the interval between "events"
With these 12 points the period is about 325441.8


这篇关于将时间戳转换为matlab fft可用形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆