How to calculate 8 days mean from ten years data?
Learn how to calculate an 8-day mean from ten years of data using MATLAB. This tutorial provides a step-by-step guide & efficient solutions. Get started now!
Learn how to calculate an 8-day mean from ten years of data using MATLAB. This tutorial provides a step-by-step guide & efficient solutions. Get started now!
%% read data file [lines, ~] = readlog('Test2.csv'); % fex : https://fr.mathworks.com/matlabcentral/fileexchange/96364-readlog?s_tid=srchtitle data_matrix = split(lines,','); [m,n] = size(data_matrix); ind_start_year = find(startsWith(data_matrix(:,1),'1-Jan-')); % find row corresponding to first day of the year ind_stop_year = find(startsWith(data_matrix(:,1),'31-Dec-')); % find row corresponding to last day of the year toc %% main loop windowSize = 8; % define buffer length for averaging cols = 3:n; % define cols to be processed dataAverages_total = []; % if the data file stops before a 31 Dec , we must add this : if numel(ind_stop_year) < numel(ind_start_year) ind_stop_year = [ind_stop_year; m]; end for ck = 1:numel(ind_start_year)% loop over year number ind_start_thisyear = ind_start_year(ck); ind_stop_thisyear = ind_stop_year(ck); start = ind_start_thisyear:windowSize:ind_stop_thisyear; stop = [start(2:end)-1, ind_stop_thisyear]; dur = stop-start+1; nbins = numel(start); dataAverages = nan(nbins, numel(cols)); for ci = 1:nbins rows = start(ci) : stop(ci); tmp = data_matrix(rows, :); dataAverages(ci,:) = mean(str2double(tmp(:,3:n)), 1, 'omitnan'); % results of one year end sum(dur) dataAverages_total = [dataAverages_total ; dataAverages]; % concatenate every year's result (dataAverages) end
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.