Line Rendering Problem
古いコメントを表示
I have a set of numbers that, when plotted, causes the linestyle to be displayed incorrectly.
The code below gives my dataset and plots them in subplot 1, the second subplot is an identical line (same max,min and number of datapoints in x and y), but with the datapoints evenly spaced along the line.
On my system (Matlab 7.11.0.584 (R2010b) running on Mac OS X 10.7.1) the line in the first plot is not displayed correctly, while it is in the second. Mysterious!
Any ideas?
% My data set
subplot(2,1,1)
x1=[4.98270000000000,4.95770000000000,4.94240000000000,4.95240000000000,4.93420000000000,4.98760000000000,4.98550000000000,4.95800000000000,4.96170000000000,4.94190000000000,4.98210000000000,4.98610000000000,4.95470000000000,4.96070000000000,4.93870000000000,4.98770000000000,4.98130000000000,4.98130000000000,4.98140000000000,4.98140000000000,4.98160000000000,4.98160000000000,4.98130000000000,4.98130000000000,4.98150000000000,4.98150000000000,4.98080000000000;];
y1=[17.0600972366516,16.9321690873624,16.8538770599974,16.9050483197131,16.8119166270306,17.0851711539123,17.0744251893720,16.9337042251539,16.9526375912487,16.8513184970117,17.0570269610687,17.0774954649550,16.9168177094477,16.9475204652771,16.8349436939026,17.0856828665095,17.0529332602914,17.0529332602914,17.0534449728886,17.0534449728886,17.0544683980829,17.0544683980829,17.0529332602914,17.0529332602914,17.0539566854857,17.0539566854857,17.0503746973056;];
plot(x1,y1,'r--')
% A generated line with the same number of data points and the same x and y
% limits.
subplot(2,1,2)
x2=min(x1):((max(x1)-min(x1))/(length(x1)-1)):max(x1);
y2=min(y1):((max(y1)-min(y1))/(length(y1)-1)):max(y1);
plot(x2,y2,'r--')
1 件のコメント
Fangjun Jiang
2011 年 8 月 30 日
What is your code?
採用された回答
その他の回答 (1 件)
Fangjun Jiang
2011 年 8 月 30 日
0 投票
I think it's expected. If you change your plot command (both) to be plot(x1,y1,'rs'), you will see the effect. (x1,y1) is not evenly spaced. The line between is the interpretation. If you change it to be plot(x1,y1,'r-'), they look more or less the same.
カテゴリ
ヘルプ センター および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!