% distribution_of_fcd_measurements.m
clc
clear

%{ 

individual script for each of the days

% load variables for the whole week
load 2014-03-24/monday_24_03.mat;
%load 2014-03-26/wednesday_26_03.mat;
%load 2014-03-27/thursday_27_03.mat;
%load 2014-03-28/friday_28_03.mat;
%load 2014-03-29/saturday_29_03.mat;
%load 2014-03-30/sunday_30_03.mat;
%load 2014-03-31/monday_31_03.mat;

% define variable for storing the data
distribution = zeros(1,24);

for i = 1:24

    for j = 1:length(m_id)
        
        % get the hour of the sample
        hours = str2num(substring(m_time{j},11,13));
        
        % store the number of measurements within given hour
        if hours == i-1
            distribution(i) = distribution(i) + 1;
        end
        
    end

end

% save data into m file
monday_distribution = distribution;
%wednesday_distribution = distribution;
%thursday_distribution = distribution;
%friday_distribution = distribution;
%saturday_distribution = distribution;
%sunday_distribution = distribution;
%monday_distribution = distribution;

%save fdc_distributions.mat monday_distribution wednesday_distribution thursday_distribution friday_distribution saturday_distribution sunday_distribution monday1_distribution
%}

% load data for the whole week from previous 
load fcd_distributions.mat

plot(0:23,monday_distribution)
set(gca,'XLim',[0 23])
set(gca,'XTick',[0:1:23])
set(gca,'YGrid','on')
set(gca, 'YTickMode','manual')
set(gca, 'YTickLabel',num2str(get(gca,'YTick')'))
xlabel('Time of day (hours)');
ylabel('Number of measurements');

hold on

plot(0:23,wednesday_distribution)
plot(0:23,thursday_distribution)
plot(0:23,friday_distribution)
plot(0:23,saturday_distribution)
plot(0:23,sunday_distribution)
plot(0:23,monday1_distribution)

legend('Monday (March 24)','Wednesday (March 26)','Thursday (March 27)','Friday (March 28)','Saturday (March 29)','Sunday (March 30)','Monday (March 31)')

