필터 지우기
필터 지우기

Plot of 2 matrix of same dimensions

조회 수: 1 (최근 30일)
Emilio Pulli
Emilio Pulli 2021년 11월 20일
편집: dpb 2021년 11월 20일
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?

채택된 답변

dpb
dpb 2021년 11월 20일
Description
plot(X,Y) creates a 2-D line plot of the data in Y versus the corresponding values in X.
  • 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.
  댓글 수: 7
Emilio Pulli
Emilio Pulli 2021년 11월 20일
Obviously I use also the hold on and hold on function…
dpb
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 CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by