Effacer les filtres
Effacer les filtres

Plotting elements of a matrix versus elements of another

3 vues (au cours des 30 derniers jours)
Ryan Magee
Ryan Magee le 5 Avr 2013
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?

Réponse acceptée

Sven
Sven le 5 Avr 2013
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 commentaire
Ryan Magee
Ryan Magee le 5 Avr 2013
Gah, of course. Thank you so much, that was a huge help!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by