Plot curve becomes jagged after 1000 data points (seems to plot one point and stretch it the length of 10)

7 次查看(过去 30 天)
I am trying to execute the following code:
dataset = importfile('MyFile.csv');
%initialize variables
time = dataset(:,2);
rolls = dataset(:,3);
figure(3)
plot(time,rolls)
The importfile function was made using Matlab's automatic tools to bring over my data set (the vectors are approx. 1900 in length).
Matlab prints the plot attached, and you can see that right at about data point 1000 the plot gets linear with what looks like Matlab drawing a straight line between every 10 points.
The other image I attached is an excel plot of the origanal data and I also coppied over the 'rolls' vector that Matlab imported. Both of the excel plots display as expected which tells me that the data is being correctly imported to Matlab.
Any comments appreciated.
  1 个评论
Piscies
Piscies 2020-10-6
Have you been able to figure this out? I am having the same issue with my imported data. It's weird because another dataset with the same number of points I imported previously did not have the issue, but the second dataset I tried did.

请先登录,再进行评论。

回答(1 个)

Kelly Kearney
Kelly Kearney 2020-6-25
It's difficult to say without actually seeing the underlying data... but at first glance this looks like a change in precision in the time variable. See, for example, the differences in the example below:
x = linspace(0,20,100);
y = rand(100,1);
plot(x,y, round(x),y);
The latter gives the same "vertical bars joined by longer straight lines" look as the latter part of your data. I'd check to see if something changed in the way the time data was recorded in your original dataset.

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by