MATLAB Answers

How to plot a mean value as a function of specific value pairs ?

Avan Al-Saffar 님이 질문을 제출함. 6 Feb 2017
최근 활동 Massimo Zanetti 님이 편집함. 10 Feb 2017
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

표시 이전 댓글 수: 2
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.
@Jan Simon: Yes, it is and sorry about that. I wanted to say that I have a two species with different initial conditions so they are x=[1,2,4] and y=[2,3,5].

로그인 to comment.

답변 수: 1

Massimo Zanetti 님의 답변 10 Feb 2017
Massimo Zanetti 님이 편집함. 10 Feb 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;

  댓글 수: 0

로그인 to comment.



Translated by