average curve of 10 plots
Ältere Kommentare anzeigen
Hi, I have 10 plots on the same figure and I need to plot an average curve of these plots. I have all the data in an excel file. I need the average plot to be on a separate figure. Could anyone help me with that? Thank you!!
Antworten (2)
Azzi Abdelmalek
am 7 Jun. 2015
Read the data from your Excell file, I suppose you have a nx10 matrix
M=rand(20,10)% Example
A=mean(M,2)
plot(A)
9 Kommentare
Inna
am 7 Jun. 2015
Azzi Abdelmalek
am 7 Jun. 2015
Do you know how to read your Excell file? How your data are disposed in each sheet?
Image Analyst
am 7 Jun. 2015
Inna, did you notice that there is an xlsread() function and it can take the sheet name or sheet number as an input? Look it up in the help.
Inna
am 7 Jun. 2015
Azzi Abdelmalek
am 7 Jun. 2015
You didn't answer my question, do you know how to read these data?
Inna
am 7 Jun. 2015
Image Analyst
am 7 Jun. 2015
Does every plot have the same x coordinates? If not, see Star's answer. If so, just average and plot. Assuming your data is called d1, d2, d3, etc. and does have common/shared x values, then:
dMean = 0.1*(d1+d2+d3+d4+d5+d6+d7+d8+d9+d10);
plot(dMean, 'b*-', 'LineWidth', 2, 'MarkerSize', 8);
grid on;
Muhammad Usman Saleem
am 7 Jun. 2015
Bearbeitet: Muhammad Usman Saleem
am 7 Jun. 2015
(1)i recomend that takes means of values in excel and then plot. (2) If you want best fit line of 10 plot use regression. But firstly makes all plots on one by using hold command. @Image please guide me about my question at http://www.mathworks.com/matlabcentral/answers/222131-how-to-make-a-function-whose-first-input-argument-is-a-cell-vector-row-or-column-of-strings-and-wh
Inna
am 7 Jun. 2015
Star Strider
am 7 Jun. 2015
0 Stimmen
I would create a common, regularly-spaced, time vector that spans the shortest time of your files (so you don’t have to extrapolate), and then use it with the interp1 function to create a second set of data for each file, now with values for the same time base. Then you should be able to average them.
5 Kommentare
Inna
am 7 Jun. 2015
Star Strider
am 7 Jun. 2015
My pleasure!
Yuan Zhu
am 11 Okt. 2018
How to create that vector?
Star Strider
am 11 Okt. 2018
Use the linspace function.
Catherine Mohs
am 4 Mär. 2019
Start Strider, could you please show us an example on how to do this? I think I know what you are trying to do, but I'm not entirely sure of the syntax. Thank you!
Kategorien
Mehr zu Line Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!