3hr time avarage plot of data
Show older comments
Hello everyone
I am trying to plot .cdf file with a 3hr moving avaerage and i started the code as follwos . I couldnt attach the data as it says data format is not supported. But here is the website to get the data from
"https://swarm-diss.eo.esa.int/#swarm%2FAdvanced%2FPlasma_Data%2F2_Hz_Langmuir_Probe_Extended_Dataset%2FSat_A"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data=('SW_EXTD_EFIA_LP_HM_20131216T000000_20131216T235959_0106.cdf');
Ne = cell2mat(cdfread(data,'Variables',{'n'})); % Electron density
ti=(cdfread(data,'Variables',{'Timestamp'})); % Time
%%%%%%%%%%%%%%%%%%%%%% Time conversion to get HH:MM:SS format
for k=1:length(ti)
datenum2(k) = todatenum(ti{k});
end
T = datetime(datenum2, 'Format','HH:mm:ss', 'ConvertFrom','excel');
t1=T';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
avg_Ne = movmean(Ne, 3*60*60/median(diff(t1)));
plot(t1, avg_Ne);
xlabel('Time');
ylabel('Ne');
title('3-Hour Time Average');
%%%%%%%%% The Error I am having
Error using cdf_3hr_average (line 82)
The denominator in matrix division for duration
arrays must be a real scalar double value.
I would be happy to hear any comments .
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Time Series Events 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!

