function coefs(nbeg,nend,size,filename);
%nbeg=1000;
%nend=1100;
%size=90;
fd=fopen(filename);%Open input file
filedt=strrep(filename,'.txt','.dt');
col=fscanf(fd,'%d',1);		%Read the number of columns
n=fscanf(fd,'%d',1);		%Read the number of rows
a=[];				%a  is a array of input data
for j=1:col		%Cycle for all columns
    b=fscanf(fd,'%e',n);	%Read a row of numbers
    a=[a;transpose(b)];		%Add a row to data array
end
str=[];				%Str is a list of the names for the columns
for i=1:col			%Cycle for columns
    b=fscanf(fd,'%s',1);	%Read the name
    str(i).name=b;		%adds the name to str
end
fclose(fd);			%Close input file
date=dlmread(filedt);	%reads file with dates.
a=transpose(a); %Transpose input data
logm=zeros(n,col);
nb=nbeg-size;
ne=nbeg;
nnn=nend-nbeg;
dates=[]; % array of dates of the current period
asp=[]; % array of average short paths
clust=[];% array of the average clustering coeficients
diam=[];% array of diameters of the graph.
degree=[];%array of degree distribution vectors
maxdegree=[]; %array of max degrees for all the steps
h = waitbar(0,'Computing...');
while (ne<nend)
for j=1:col
    for i=nb:ne
        logm(i,j)=log(a(i,j))-log(a(i-1,j));
    end
end
    R=corrcoef(logm);
    dist=sqrt(2*(1-R));
    R1=prim2(dist);
    shortp=floyd(dist);
    asp=[asp,avg_short_path(shortp)];
    diam=[diam,diameter(shortp)];
    clust=[clust,Cluster_Coef(R)];
    maxd=0;degr=[];
    [maxd,degr]=degree_distr(R1);
    maxdegree=[maxdegree,maxd];
    degree=[degree;degr];
    dates=[dates,date(ne)];
    nb=nb+1;
    ne=ne+1;
    waitbar((nnn-nend+ne)/nnn);
    date(ne)
end
close(h);
p=axes;
plot(dates,clust);
set(p,'XTick',[19871020,19871021]);
set(p,'XTickLabel','21.10.1987 kjh');
title('Clustering');
grid on;
figure;
p=axes;
plot(dates,asp);
set(p,'XTick',19871021);
set(p,'XTickLabel','21.10.1987');
title('Average short path');
grid on;
figure;
p=axes;
plot(dates,diam);
set(p,'XTick',19871021);
set(p,'XTickLabel','21.10.1987');
title('Diameter');
grid on;
figure;
p=axes;
plot(dates,maxdegree);
set(p,'XTick',19871021);
set(p,'XTickLabel','21.10.1987');
title('Max node degree');
grid on;