From: jenya on 20 Apr 2010 00:57 Hi, sorry...I guess I should have been more clear. I do not know how to edit xaxiis. It rounds it but I'd rather it appear the same as time vector. THANKS TideMan <mulgor(a)gmail.com> wrote in message <3ce3d093-7420-451e-899f-b53ee6572f9f(a)m24g2000prc.googlegroups.com>... > On Apr 20, 1:59 pm, "jenya polyakova" <jeny...(a)yahoo.com> wrote: > > I have 4 vectors (here is an example, my vectors are larger than that) > > (in time1 and time2 1992 represents year and 02 represents month) > > time1 = [199202 199512] > > data1 = [0.5 0.6] > > time2 = [199512 199812] > > data2 = [0.4 0.5] > > > > I know want to plot these vectors as: > > plot(time1, data1); > > hold on > > plot(time2, data2); > > but it gives me wrong plots... > > Any suggestions? > > What do you mean, it gives the wrong plots? > It gives me 2 diagonal lines, which is what I expect looking at the > data. > What did you expect?
From: TideMan on 20 Apr 2010 05:55 On Apr 20, 4:57 pm, "jenya " <jeny...(a)yahoo.com> wrote: > Hi, sorry...I guess I should have been more clear. I do not know how to edit xaxiis. It rounds it but I'd rather it appear the same as time vector. THANKS > > TideMan <mul...(a)gmail.com> wrote in message <3ce3d093-7420-451e-899f-b53ee6572...(a)m24g2000prc.googlegroups.com>... > > On Apr 20, 1:59 pm, "jenya polyakova" <jeny...(a)yahoo.com> wrote: > > > I have 4 vectors (here is an example, my vectors are larger than that) > > > (in time1 and time2 1992 represents year and 02 represents month) > > > time1 = [199202 199512] > > > data1 = [0.5 0.6] > > > time2 = [199512 199812] > > > data2 = [0.4 0.5] > > > > I know want to plot these vectors as: > > > plot(time1, data1); > > > hold on > > > plot(time2, data2); > > > but it gives me wrong plots... > > > Any suggestions? > > > What do you mean, it gives the wrong plots? > > It gives me 2 diagonal lines, which is what I expect looking at the > > data. > > What did you expect? Well, you can't do it that way. The reason is that 199202 is not a wholly decimal number, which is what Matlab deals with. The last two digits are duodecimal, not decimal. They go to 12 before the 3rd digit from the right increments. So, you need to convert your numbers to decimal numbers that Matlab can deal with. One way is to use Matlab days, see help datenum Another way is to number in months from the start of the record, then simply re-label the x-axis ticks to yyyymm format.
|
Pages: 1 Prev: display something for 2 seconds Next: Constrained Portfolio Optimization |