Getting the period from irregularly-spaced time series using OCTAVE

自古美人都是妖i 提交于 2020-01-17 04:14:10

问题


I have a two column array of data. First column is time (date in decimal years) and second column is the signal strength. The plot is a triangle wave or should be ideally because the sampling is irregularly timed. I've tried numerous methods to get the period of the wave, including fitting a sine wave to the data via lsqcurvefit, but it doesn't always return the right period. Using OCTAVE how do I get the period (my main aim) of this/any irregularly-spaced time series?See plot


回答1:


Found answer to my own question. The lomb custom function (here) is one of several at matlab central, but this one works without problems in OCTAVE.

[P,f,alpha] = lomb(M,date);
[maxpower,maxpowerindex] = max(P);
rightfreq = f(maxpowerindex);
Period = 1/rightfreq


来源:https://stackoverflow.com/questions/42846316/getting-the-period-from-irregularly-spaced-time-series-using-octave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!