필터 지우기
필터 지우기

Plotting elements of a matrix versus elements of another

조회 수: 4 (최근 30일)
Ryan Magee
Ryan Magee 2013년 4월 5일
I have two m x n matrices. I want to make a scatter (well, a STEM really) that plots the 'x' value in index i,j of the first matrix against the 'y' value in index i,j of the second matrix. I'm just drawing a blank here...I feel like there is a simple way to do it without a loop, but I'm pretty new to Matlab. Any suggestions?

채택된 답변

Sven
Sven 2013년 4월 5일
Ryan, does this do what you wanted?
X = rand(10,10)
Y = X^2
figure, stem(X(:),Y(:))
The (:) operator will basically flatten any sized matrix into a column vector.
  댓글 수: 1
Ryan Magee
Ryan Magee 2013년 4월 5일
Gah, of course. Thank you so much, that was a huge help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by