MATLAB Answers

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

12 ビュー (過去 30 日間)
Camden Boston
Camden Boston 2020 年 6 月 25 日
コメント済み: Piscies 2020 年 10 月 6 日 14:19
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 日 14:19
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.

  0 件のコメント

サインインしてコメントする。

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by