average of the graphs

Hi
I am new to Matlab, but till now I have learnt a lot. Now I am stuck with a problem would be quite simple for the Matlab user but quite difficult for me at this stage. I have done an experiment 5 times so the data of the experiment looks like this;
X Y1 Y2 Y3 Y4 Y5
1 10 15 16 12 11
2 20 23 19 16 21
3 30 32 28 25 33
4 40 38 44 45 39
I can create 5 graphs on a single graphs. but I would like to have a single graph which shows the average of all the graphs, I mean at value of x, the y value should be (Y1+Y2+Y3+Y4+Y5)/5.
Can you please help me?
Regards,

1 Comment

X Y1 Y2 Y3 Y4 Y5
1 10 15 16 12 11
2 20 23 19 16 21
330 32 28 25 33
4 40 38 44 45 39

Sign in to comment.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 19 Feb 2013
Edited: Azzi Abdelmalek on 19 Feb 2013
data=[1 10 15 16 12 11
2 20 23 19 16 21
3 30 32 28 25 33
4 40 38 44 45 39]
data_mean=mean(data(:,2:end),2)
idx=data(:,1)
plot(idx,data_mean)

3 Comments

Thanks you so much Azzi Abdelmalek. but I encounter another problem. I have the data in 5 different files. The size of the file is too big. I can load these files but I don't know how to gather these files into one file. Sorry about that but I would be really thankful.
with kind regrards
Do you mean, how to concatenate your data, not the files.
If you have juste 5 files,
data=[data1;data2;data3;data4;data5]

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 19 Feb 2013

Community Treasure Hunt

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

Start Hunting!