Can anyone give me the exact statement I must use to prevent this additional line from coming between the plot extremities?

1 回表示 (過去 30 日間)
Can anyone give me the exact statement I must use to prevent this additional line from coming between the plot extremities? Can anyone give me the exact statement I must use to prevent this additional line from coming between the plot extremities?
I am using this statement:
plot([r r+1],[STATISTICS(r).AVG STATISTICS(r+1).AVG],'green');
kindly do let me know if the code is needed I shall put it up

採用された回答

OCDER
OCDER 2019 年 1 月 8 日
Seems like your X values are not sorted, causing the lines to loop around. To fix, sort your X and Y values. See example below:
X = [1:10 1]; % X goes back to 1
Y = sin(X);
plot(X, Y); %Similar to your situation
%To fix, sort your X and Y
[X, SortIdx] = sort(X);
Y = Y(SortIdx);
plot(X, Y); %Fixed
  1 件のコメント
utsav kakkad
utsav kakkad 2019 年 2 月 1 日
編集済み: utsav kakkad 2019 年 2 月 1 日
thanks I fixed it finally it was that the values were not balanced

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by