help-octave
[Top][All Lists]
Advanced

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

Re: Beginners Question - diagram date / values


From: siko1056
Subject: Re: Beginners Question - diagram date / values
Date: Sun, 4 Mar 2018 10:31:15 -0700 (MST)

Martin Wagner wrote
> Hi @all,
> 
> I'm trying to create a simple time / values X-Y diagram. However, I'm
> having a weird resolution problem on the X axis. 
> For some reason, multiple y values are assinged to one sinlge X time
> value (see https://ibb.co/eZJYxn).
> This is the same data in libre office: https://ibb.co/iLYcOS .
> 
> When I check the time values, all of them are the same values.
> 
> Any ideas what I'm doing wrong?
> 
> Thanks for your help!
> 
> [ ... snip ... ]
> 
> a{1} = datenum(a{1},'dd.mm.yyyy HH:MM:SS');
> a
> a = 
> {
>   [1,1] =
> 
>      7.3712e+05
>      7.3712e+05
>      7.3712e+05
>      7.3712e+05
>      7.3712e+05
>      7.3712e+05
>      7.3712e+05
> 
> [snip]

My guess is, that your x-axis values are badly scaled.  Your values are
about 10^5, but the differences in the numbers is about 10^(-2), likely to
exceed the tolerance of single precision.  Maybe try something like below:

```
blub = ["Time,Temperature\n" ...
"27.02.2018 17:10:56,19.99\n" ...
"27.02.2018 17:11:57,19.91\n" ...
"27.02.2018 17:12:58,20.01\n" ...
"27.02.2018 17:13:59,19.98\n" ...
"27.02.2018 17:15:00,20.15\n" ...
"27.02.2018 17:16:01,20.20\n" ...
"27.02.2018 17:17:02,20.14"];

a = textscan (blub, '%s %f', 'Delimiter', ',', 'HeaderLines', 1);
a{1} = datenum (a{1}, 'dd.mm.yyyy HH:MM:SS');
x = a{1};
y = a{2};
figure ();
plot (x, y)
figure ();
plot (x - x(1), y)
```

HTH,
Kai



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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