# How to plot the average plot out of three plots

11 vues (au cours des 30 derniers jours)
DEWDROP le 26 Août 2020
Commenté : DEWDROP le 28 Août 2020
Hello everyone, i have extracted the data from the excel to plot the graphs .Now , i want to plot the average plot in the same graph .i have three plots in the same graph which each of the three has different 1 column but different rows.i would be grateful if anyone could help me to get the idea of how to plot that graph.Thank you in advance.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

KSSV le 26 Août 2020
You should decide the x-axis same for all the data and make y-values NaN for out of odmain/ extrapolation range and use mean/ nanmean.
1. Check the dimensions of each data.
2. Fix the common x-axis data to get the all the data to this x-axes. I would pick the data1, as it covers the more range of x-axes when compared to other data.
3. Get the data2, data3 to the x-axes domain of data1.
4. Use interp1 to get the data2, data3 to the x-axes range of data1. The extrapolation points should be set to NaN.
5. Use nanmean or mean nan flags to get the avarage of data1, data2 and data3.
##### 6 commentairesAfficher 4 commentaires plus anciensMasquer 4 commentaires plus anciens
DEWDROP le 27 Août 2020
KSSV le 27 Août 2020
Why don't you attach all your data in a mat file..

Connectez-vous pour commenter.

### Plus de réponses (1)

DEWDROP le 28 Août 2020
HERE ,i have attached the excel as well s mat file.Thank you for your continuous help
##### 2 commentairesAfficher AucuneMasquer Aucune
KSSV le 28 Août 2020
x1 = data(:,2) ;
y1 = data(:,1) ;
%
x2 = data(:,4) ;
y2 = data(:,3) ;
%
x3 = data(:,6) ;
y3 = data(:,5) ;
plot(x1,y1,x2,y2,x3,y3)
hold on
plot(x1,[y1+y2+y3]/3) ;
legend('data1','data2','data3','average')
DEWDROP le 28 Août 2020
Data.mat is not able to open .and also data 2 and data 3 has not the ssame value so we need tto interpolate?

Connectez-vous pour commenter.

### Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by