average of the graphs
Show older comments
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
Syed Talha Ali
on 19 Feb 2013
Answers (1)
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
Syed Talha Ali
on 19 Feb 2013
Azzi Abdelmalek
on 19 Feb 2013
Do you mean, how to concatenate your data, not the files.
Azzi Abdelmalek
on 19 Feb 2013
If you have juste 5 files,
data=[data1;data2;data3;data4;data5]
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!