How to plot with different sized matrices ?

16 vues (au cours des 30 derniers jours)
SHRIVATHSA S.
SHRIVATHSA S. le 25 Avr 2017
Commenté : Walter Roberson le 12 Mai 2017
I have a matrix of 1x1000 and another matrix of 1x10. How can I plot these two against each other?
  4 commentaires
SHRIVATHSA S.
SHRIVATHSA S. le 12 Mai 2017
I have a (1 x 1000) and a (1 x 10) matrix. I want to plot these together. How can I do that?
Steven Lord
Steven Lord le 12 Mai 2017
I'm not quite sure what you mean by "plot these two against each other". How many points would you want to appear on the axes when executing this smaller example, and EXACTLY where would you want those points to appear? Would there be anything special or unusual about any or all of those points? Different colored markers, different sized markers, different markers entirely, etc. [Note that this will NOT work as written; there is no plotForShrivathsaS function. If such a function were to exist, how should it behave?]
x1 = [1 2 3 4];
x2 = [5 6 7];
plotForShrivathsaS(x1, x2)

Connectez-vous pour commenter.

Réponses (2)

KSSV
KSSV le 25 Avr 2017
x1 = rand(1,100) ;
x2 = rand(1,10) ;
%%plo tonly matrices
plot(x1,'r') ;
hold on
plot(x2,'g') ;
legend('data1', 'data2');
  2 commentaires
SHRIVATHSA S.
SHRIVATHSA S. le 12 Mai 2017
@KSSV this code plots x1 and x2 individually. i want to plot with x1 on x-axis and x2 on y-axis.
Walter Roberson
Walter Roberson le 12 Mai 2017
x = rand(1,100) ;
y = rand(1,10) ;
%%plot only matrices
plot(x, zeros(size(x)), 'r*-') ;
hold on
plot(zeros(size(y), y, 'g*-') ;

Connectez-vous pour commenter.


Walter Roberson
Walter Roberson le 12 Mai 2017
[X, Y] = ndgrid(x1000, y10);
scatter(X(:), Y(:))

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by