% eda02_07
% running histogram of temperature

% read the data
D=load('brf_temp.txt');
t=D(:,1);
d=D(:,2);
Ns=size(D);
N=Ns(1);
M=Ns(2);

% bins
Lh = 100;
dmin = min(d);
dmax = max(d);
bins = dmin + (dmax-dmin)*[0:Lh-1]'/(Lh-1);

% Lw moving window histograms, each offset long
offset=1000;
Lw=floor(N/offset)-1;
Dhist = zeros(Lh, Lw);
for i = [1:Lw];
    j=1+(i-1)*offset;
    k=j+offset-1;
    Dhist(:,i) = hist(d(j:k), bins)';
end

% Set up graphics
figure(1);
clf;
set(gca,'LineWidth',2);
axis([-Lw/8, 9*Lw/8, -Lh/8, 9*Lh/8]);
hold on;
axis ij;
axis equal;
axis off;

bw=0.9*(256-[0:255]')/256;
colormap([bw,bw,bw]);

% plot the matrix Dhist
imagesc( [0, Lw-1], [0, Lh-1], Dhist);
text(6*Lw/16,17*Lw/16,'Dhist');





