- If X and Y are both vectors, then they must have equal length. The plot function plots Y versus X.
- If X and Y are both matrices, then they must have equal size. The plot function plots columns of Y versus columns of X.
Plot of 2 matrix of same dimensions
3 ビュー (過去 30 日間)
古いコメントを表示
If I have two matrixes of same dimensions, and I type:
plot(A,B)
The code automatically associates each row of matrix A to the same row of matrix B by realizing a different number of curves corresponding to the row number of the matrixes?
0 件のコメント
採用された回答
dpb
2021 年 11 月 20 日
Description
7 件のコメント
dpb
2021 年 11 月 20 日
編集済み: dpb
2021 年 11 月 20 日
That's also simple enough without the loop...
hL=plot(X.',Y.');
set(hL,{'DisplayName'},compose('Line %02d',1:size(X,1)).')
legend(hL)
Salt the string generation to suit...any set of parameters that can be codified in line can be used in lookup array fashion or computed dynamically as well.
Or, just use legend() directly to achieve same result --
legend(compose('Line %02d',1:size(X,1)).','Location','northwest')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!