Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to plot hourly and daily dataset together in the same datenum figure

Subject: how to plot hourly and daily dataset together in the same datenum figure

From: Kuo-Hsien

Date: 4 Jun, 2012 23:10:07

Message: 1 of 4

Hi all,

I have two datasets at a hourly and daily time-step. I like to show them in the same figure.

I have truble to get the correct length of datenum for hourly time-step.

Please let me know how to do it.

Thanks,
Michael

Subject: how to plot hourly and daily dataset together in the same datenum

From: Nasser M. Abbasi

Date: 4 Jun, 2012 23:14:22

Message: 2 of 4

On 6/4/2012 6:10 PM, Kuo-Hsien wrote:
> Hi all,
>
> I have two datasets at a hourly and daily time-step. I like to show them in the same figure.
>
> I have truble to get the correct length of datenum for hourly time-step.
>
> Please let me know how to do it.
>
> Thanks,
> Michael


give small example of the data

Subject: how to plot hourly and daily dataset together in the same datenum

From: Kuo-Hsien

Date: 5 Jun, 2012 00:05:09

Message: 3 of 4

"Nasser M. Abbasi" <nma@12000.org> wrote in message <jqjfge$95h$1@speranza.aioe.org>...
> On 6/4/2012 6:10 PM, Kuo-Hsien wrote:
> > Hi all,
> >
> > I have two datasets at a hourly and daily time-step. I like to show them in the same figure.
> >
> > I have truble to get the correct length of datenum for hourly time-step.
> >
> > Please let me know how to do it.
> >
> > Thanks,
> > Michael
>
>
> give small example of the data

hourly = (1:24*30)'
daily = rand(1,30)'
I like to plot them together and the date tick shows 2001/01/01 to 2001/01/30.

Thanks,
Michael

Subject: how to plot hourly and daily dataset together in the same datenum

From: Nasser M. Abbasi

Date: 5 Jun, 2012 00:13:33

Message: 4 of 4

On 6/4/2012 7:05 PM, Kuo-Hsien wrote:

>
> hourly = (1:24*30)'
> daily = rand(1,30)'
> I like to plot them together and the date tick shows 2001/01/01 to 2001/01/30.
>

So, you just have Y1 , and Y2 ?

Then the X1 used will be the index of the Y1 values, and the same for
X2.

Then just use the plot command

         plot(1:length(Y1),Y1,1:length(Y2),Y2)

Where Y1 is your hourly
and Y2 is your daily.

Are you sure this is your data? I thought you'll have
(x,y) for each data set. any way, plot can be used
to plot 2 sets of data, using plot(X1,Y1,X2,Y2)
see help on plot for more info

--Nasser

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us