
Re: How does one get data out of a TemporalData object?
Posted:
Jun 17, 2013 6:17 AM


In article <kpjvbv$9mc$1@smc.vnet.net>, Andy Ross <andyr@wolfram.com> wrote:
Andy,
> TemporalData has a number of properties for extracting the parts you > need. To get the paths with time stamps use TemporalData[...]["Paths"]. > To get the states use TemporalData[...]["States"]. > > I recommend looking at the details section of the documentation for > TemporalData to see the full list of properties and read through the > examples on that page to see how each is used.
I had looked over the documentation, and nothing jumped out. I looked at every mention of TemporalData, and found nothing that seemed suitable.
But I didn't try States, so I just did. It yields a list of alternating 1 and 2 values, which isn't a complete answer to the problem, as the time values are missing. If one just uses Fourier[], one will get some kind of Periodogram, which is not what is sought.
Let me give a code example:
\[ScriptCapitalP] = ContinuousMarkovProcess[{1, 0}, ({ {3, 3}, {1, 1} })]; data=RandomFunction[\[ScriptCapitalP],{0,20}] Fourier[data]
This yields a complaint: Fourier::fftl: (((((("\"Argument \!\(\*TagBox[\nRowBox[{\\\"TemporalData\\\", \\\"[\\\", PanelBox[" 1) ", FrameMargins>Small], \\\"]\\\"}], InterpretTemplate[TemporalData[Automatic, {{{1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1}}, {{{0``15.954589770191005, 0.01520207123587128013320057817736596917`14.129940038322594, 0.95824522046395536932862513249273766604`15.644199356725549, 1.53128564596308252148382664967984035205`15.736304825316484, 2.28962713530000690099771260582537312886`15.797207858258304, 3.28670141416927664988333023187555326092`15.839226787640209, 3.38168097695521799981621844019305806672`15.842081650549387, 4.0716904019295301685379386805431332727`15.859211783981653, 5.25370702200219072713176547011226038622`15.878918089214274, 5.91828379716574832280816964564910319058`15.88678718369098, 6.12633788645240157414249230434964341735`15.888924305967711, 6.19666658844600659408879868858704605186`15.889616516866917, 9.58526332575202981025003709494096121015`15.911492152203763, 9.8441361181069966832633195553354003832`15.912572420088354, 14.33613695082054447978910756738149487066`15.925305933162454, 14.96549983870748084202749476200455050281`15.926498477053611, 15.17014786638371663403108748271496533041`15.92686559286194, 15.36161929373388768828517022927544623659`15.927200484830422, 15.67573549317739061376647722217804251544`15.927732699101226, 15.8362986262877527919959498312816012794`15.927996832624787, 16.94396941821241069345266065715083372759`15.929686408696478, 17.04737697478590359190098510749722701209`15.929833245160726, 22.73457835309395939446096043959096018021`15.93589515332067}}}, 1, {") Discrete) ", 1}, {") Continuous) ", 1}, 1, {}}]& ], Editable>False, SelectWithContents>True, Selectable>True]\) is not a nonempty list or rectangular array of numeric quantities.\"")
Now, note that the following appears to work:
plot1 = ListLinePlot[data, InterpolationOrder > 0, PlotRange > {1, 2.1}, Ticks > {Automatic, {1, 2, 3}}, Filling > Bottom]
But when I do this:
datainter = Interpolation[Normal[data] // First, InterpolationOrder > 0] plot2 = Plot[datainter[t], {t, 0, 20}, PlotRange > All, Filling > Bottom]
I get a different answer, and other paths yield yet other answers.
What I'm looking for is for instance a function that can be called from Table[] to yield a list of equispaced samples suitable for Fourier[]. The locations and interval between samples may vary as needed to keep Fourier happy  list length will be an exact power of two, and there may be zero padding added.
Thanks,
Joe Gwinn
> Andy Ross > Wolfram Research > > On 6/15/2013 3:25 AM, Joe Gwinn wrote: > > I would like to generate some random signals for use in exploring > > signalprocessing algorithms. > > > > For use as synthetic signals for the algorithm to chew upon, I'd like > > to use ContinuousMarkovProcess and TelegraphProcess with > > RandomFunction. With these, I can do statistics and plot things > > freely. > > > > What I cannot quite get is a time series ready for such indignities as > > Fourier[]. > > > > Now I can manually disassemble the data structure, but I don't find a > > list of equispaced samples, I get a transition list, which is not the > > same thing. > > > > Interpolation[Normal[temporal data object] // First, InterpolationOrder > > > 0] almost works, but the fine details are smeared over, even though > > InterpolationOrder > 0 works in ListLinePlot et al without apparent > > smearing. > > > > What am I missing? It seems like Probability and Statistics has become > > a walled city within Mathematica. I'm hoping to find a door in the wall, > > rather than be forced to build by own little city one brick at a time. > > > > Joe Gwinn > > > >

