help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plotting time series in Octave


From: Ben Abbott
Subject: Re: plotting time series in Octave
Date: Sun, 25 Mar 2012 17:59:54 -0400

On Mar 25, 2012, at 5:49 PM, financial engineer wrote:

> I have the following data and I am trying to plot the time series and an 
> overlay of signals on it
> 
> 2011-12-06 02:15:00," 3.113830e-01"," 1.909586e+02","U","8575.000","   
> 0.000","   0.000","   0","0.887775615"
> 2011-12-06 02:16:00," 2.630128e-01"," 1.848320e+02","U","8575.000","   
> 0.000","   0.000","   0","0.891741773"
> 2011-12-06 02:17:00," 2.194390e-01"," 
> 1.784746e+02","B","8575.000","8554.142","8556.332","8550","0.892192117"
> 2011-12-06 02:18:00," 1.750296e-01"," 
> 1.727000e+02","B","8575.000","8554.287","8556.518","8550","0.894445120"
> 2011-12-06 02:19:00,"-2.392036e+00"," 1.558317e+02","U","8580.000","   
> 0.000","   0.000","   0","0.898210621"
> 2011-12-06 02:20:00,"-3.538674e+00"," 3.513018e+02","U","8580.000","   
> 0.000","   0.000","   0","0.898689659"
> 2011-12-06 02:21:00,"-5.469638e+00"," 6.806506e+02","U","8582.500","   
> 0.000","   0.000","   0","0.901698147"
> 
> I have converted the data into a matrix:
> C=csv2cell("test.csv",",")
> 
> and then ran the following command:
> octave-3.2.4:23> C{3:4,1:9}
> ans = 2011-12-06 02:17:00
> ans = 2011-12-06 02:18:00
> ans =  0.21944
> ans =  0.17503
> ans =  178.47
> ans =  172.70
> ans = B
> ans = B
> ans =  8575
> ans =  8575
> ans =  8554.1
> ans =  8554.3
> ans =  8556.3
> ans =  8556.5
> ans =  8550
> ans =  8550
> ans =  0.89219
> ans =  0.89445
> 
> I tried to plot using the following command:
> octave-3.2.4:22> plot(C{3:4,5},C{3:4,6})
> 
> and I get a blank graph....obviously I am doing something silly....
> 
> my ultimate goal is:
> 1. plot a time series with the first column as my x-axis and the 5th column 
> as my y-axis
> 2. overlay points on the time series graph (at the price) to indicate a B 
> whenever a B shows up in the 4th column
> 
> Can someone please help me make the first correct step so I can move to the 
> second step. Thanks!

I haven't tested this, but your plot command is equivalent to ...

        plot (C{3,5}, C{4,5}, C{3,6}, C{4,6})

I assume you want ...

        plot ([C{3,5}, C{4,5}], [C{3,6}, C{4,6}])

You can do that by ...

        plot ([C{3:4,5}], [C{3:4,6}])

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]