[scilab-Users] drawing out of two data files

Francis Drossaert Francis.Drossaert at pgs.com
Mon Sep 20 14:56:39 CEST 2010


t1 = 0:1/(length(data1)-1):tend;
t2 = 0:1/(length(data2)-1):tend;

plot(t1,data1);
plot(t2,data2);

where is tend is your time span.

From: Peng Du [mailto:eddy.pdu at gmail.com]
Sent: 20 September 2010 13:42
To: users at lists.scilab.org
Subject: Re: [scilab-Users] drawing out of two data files

Thanks for your replies. They are definitely useful but I think it would be better to make my problem clearer:

Different to the example Antoine provided, my data looks more like
data1=[1,5,76,2,7,32,54,6,343,675,454,32,121,5,6,8,]
data2=[3,12,43,54,65,76]

They are the data collected from an experiment and unlikely to have any mathematical relationship. The first and last value happen at the same moment ("1" in data1 and "3" in data2 happens simultaneously). The difference in the sizes of data1 and data2 is due to the different sampling rate when collecting data.

What I'd like to do is something like "plot(t,data1); plot(t,data2)" where t denotes the timespan. So that in the graph the "1" in data1 and "3" in data2 are aligned to the identical x-axis position (time) whilst "8" in data1 and "75" in data2 are also aligned. And everything else in between should be averagely distributed.

So how can I get it done?

Thanks very much.
On 20 September 2010 13:08, Francis Drossaert <Francis.Drossaert at pgs.com<mailto:Francis.Drossaert at pgs.com>> wrote:
Just use plot(x,y) or plot2d(,xy) rather than just plot(y) or plot2d(y). Scilab will plot irregular sampled data correctly.

For example this will plot a straight line even it irregular sampled:
x = [0,1,2,3,4,4.5,5,5.5,6];
y = [1,2,3,4,5,5.5,6,6.5];
plot(x,y);


From: Peng Du [mailto:eddy.pdu at gmail.com<mailto:eddy.pdu at gmail.com>]
Sent: 20 September 2010 12:49
To: users at lists.scilab.org<mailto:users at lists.scilab.org>
Subject: [scilab-Users] drawing out of two data files

Hi everyone.

I have two data files containing information of the event with the same timespan but in different sampling rate, i.e. they have different sizes but the first and last line denote the identical moment.

Is there any way I can draw them in one graph and have them proper aligned? Thanks a lot.

Best regards,

Peng

This e-mail, including any attachments and response string, may contain proprietary information which is confidential and may be legally privileged. It is for the intended recipient only. If you are not the intended recipient or transmission error has misdirected this e-mail, please notify the author by return e-mail and delete this message and any attachment immediately. If you are not the intended recipient you must not use, disclose, distribute, forward, copy, print or rely on this e-mail in any way except as permitted by the author.   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100920/3ff660ee/attachment.htm>


More information about the users mailing list