How to plot a mean value as a function of specific value pairs ?
Afficher commentaires plus anciens
How can I plot the following data in a nice plot?
a=[ [1 2], [2 3], [4 5] ]; mean= [ 5.43, 6.78, 5.66];
Thank you
5 commentaires
John D'Errico
le 6 Fév 2017
The phrase "a nice plot" has no real meaning, except to you. What kind of plot would you wish to see? Does your plot live in two dimensions? In three dimensions? Explain what it looks like as you want to see it.
Massimo Zanetti
le 6 Fév 2017
Modifié(e) : Massimo Zanetti
le 6 Fév 2017
Is this nice?
X=[1,2,4];
Y=[2,3,5];
Z=[5.43,6.78,5.66];
plot3(X,Y,Z,'*');
grid on;
@Avam Al-Saffar: Type this in the command window:
a = [[1 2], [2 3], [4 5]]
b = [1,2,2,3,4,5]
isequal(a, b) % replies TRUE
Both are exactly the same.
@Massimo: Please post your solution as answer, such that it can be accepted to mark this thread as solved. Thanks.
Avan Al-Saffar
le 8 Fév 2017
Modifié(e) : Avan Al-Saffar
le 8 Fév 2017
Réponses (1)
Massimo Zanetti
le 10 Fév 2017
Modifié(e) : Massimo Zanetti
le 10 Fév 2017
First, notice that in Matlab a=[ [1 2], [2 3], [4 5] ] equals a=[1,2,2,3,4,5]. I guess, you meant to associate each entry of mean=[5.43, 6.78, 5.66] with one coordinate couple (x,y) in a.
To do that, just define your X and Y and plot mean against them:
X=[1,2,4];
Y=[2,3,5];
mean=[5.43,6.78,5.66];
plot3(X,Y,mean,'*');
grid on;
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!