How to plot average (line) from multiple graph?

18 visualizaciones (últimos 30 días)
Noor Fatihah Yasmine
Noor Fatihah Yasmine el 29 de Dic. de 2020
Comentada: Noor Fatihah Yasmine el 30 de Dic. de 2020
How can I find the average for this graph? I need to find the average present of MCEJ1 from CDO, DAV, CEB, MND and LGZ.
I need it to display the average like this graph
Below is my coding for this graph :
%% GG Longitude
% Input longitude for station
LONCEB=123.91;
LONDAV=125.40;
LONMUT=121.02;
LONCDO=124.64;
LONLGZ=123.74;
LONAAB=38.77;
LONMND=124.84;
%% Load data CDO
load('CDO1m.mat');
load('DAV1m.mat');
load('CEB1m.mat');
load('MND1m.mat');
load('LGZ1m.mat');
%% Change UT to LT
LT1mCDO=UT1m+LONCDO/15/24;
LT1mDAV=UT1m+LONDAV/15/24;
LT1mCEB=UT1m+LONCEB/15/24;
LT1mMND=UT1m+LONMND/15/24;
LT1mLGZ=UT1m+LONLGZ/15/24;
%% Choose date
datechooseCDO=find(and(LT1mCDO>=datenum(2014,12,31,0,0,0),LT1mCDO<datenum(2015,1,1,0,0,0)));
datechooseDAV=find(and(LT1mDAV>=datenum(2014,12,31,0,0,0),LT1mDAV<datenum(2015,1,1,0,0,0)));
datechooseCEB=find(and(LT1mCEB>=datenum(2014,12,31,0,0,0),LT1mCEB<datenum(2015,1,1,0,0,0)));
datechooseMND=find(and(LT1mMND>=datenum(2014,12,31,0,0,0),LT1mMND<datenum(2015,1,1,0,0,0)));
datechooseLGZ=find(and(LT1mLGZ>=datenum(2014,12,31,0,0,0),LT1mLGZ<datenum(2015,1,1,0,0,0)));
% Collect LT1m annually
LT1mdatechooseCDO=LT1mCDO(datechooseCDO);
LT1mdatechooseDAV=LT1mDAV(datechooseDAV);
LT1mdatechooseCEB=LT1mCEB(datechooseCEB);
LT1mdatechooseMND=LT1mMND(datechooseMND);
LT1mdatechooseLGZ=LT1mLGZ(datechooseLGZ);
% Collect EEJ data annually
nEUELdatechooseCDO=nEUELCDO1m(datechooseCDO);
nEUELdatechooseDAV=nEUELDAV1m(datechooseDAV);
nEUELdatechooseCEB=nEUELCEB1m(datechooseCEB);
nEUELdatechooseMND=nEUELMND1m(datechooseMND);
nEUELdatechooseLGZ=nEUELLGZ1m(datechooseLGZ);
%% Choose quiet days data
load('Kp050101-180907.mat');
% Change hourly Kp reading to minute
Kphourly=Kp;
Kpmin=repelem(Kphourly,60); %Kp for minute array
% Find quiet days
KpmindatechooseCDO=Kpmin(datechooseCDO);
postCDO=find(KpmindatechooseCDO>3);
KpmindatechooseCDO(postCDO)=NaN; %NaN kan disturb days
KpmindatechooseDAV=Kpmin(datechooseDAV);
postDAV=find(KpmindatechooseDAV>3);
KpmindatechooseDAV(postDAV)=NaN; %NaN kan disturb days
KpmindatechooseCEB=Kpmin(datechooseCEB);
postCEB=find(KpmindatechooseCEB>3);
KpmindatechooseCEB(postCEB)=NaN; %NaN kan disturb days
KpmindatechooseMND=Kpmin(datechooseMND);
postMND=find(KpmindatechooseMND>3);
KpmindatechooseMND(postMND)=NaN; %NaN kan disturb days
KpmindatechooseLGZ=Kpmin(datechooseLGZ);
postLGZ=find(KpmindatechooseLGZ>3);
KpmindatechooseLGZ(postLGZ)=NaN; %NaN kan disturb days
nEUELdatechooseCDO(postCDO)=NaN;
EEJCDO=nEUELdatechooseCDO;
nEUELdatechooseDAV(postDAV)=NaN;
EEJDAV=nEUELdatechooseDAV;
nEUELdatechooseCEB(postCEB)=NaN;
EEJCEB=nEUELdatechooseCEB;
nEUELdatechooseMND(postMND)=NaN;
EEJMND=nEUELdatechooseMND;
nEUELdatechooseLGZ(postLGZ)=NaN;
EEJLGZ=nEUELdatechooseLGZ;
%% Plot data raw CEJ during quiet days
figure
plot(LT1mdatechooseCDO,EEJCDO)
hold on
plot(LT1mdatechooseDAV,EEJDAV)
hold on
plot(LT1mdatechooseCEB,EEJCEB)
hold on
plot(LT1mdatechooseMND,EEJMND)
hold on
plot(LT1mdatechooseLGZ,EEJLGZ)
%ylim([-100,0])
datetick('x')
xlabel('Local Time')
ylabel('nT')
title('Present of MCEJ1 on 31/12/2014')
grid on
hold off
legend('CDO','DAV','CEB','MND','LGZ');
%% Find average for all station
Thank you.
  2 comentarios
Adam Danz
Adam Danz el 29 de Dic. de 2020
If all of the time series have the same sampling (same x-values), you just need to average their y-values.
Noor Fatihah Yasmine
Noor Fatihah Yasmine el 30 de Dic. de 2020
Alright, I got it. Thank you :)

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 29 de Dic. de 2020
I cannot follow your code, and I do not have your data.
See if the approach in: Average of Wave from 10 waves in single graph will do what you want.

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by