%% Leitura do arquivo
clear
IDIOMA = 'Portugues';
% IDIOMA = 'Ingles';
fid = fopen( sprintf('Lista_Limpa_%s.txt',IDIOMA) );
A = fgetl( fid );
fclose( fid );

%% determinacao da estatistica dos tamanhos
onde_espaco = find( A==32 );
Tamanhos = diff( onde_espaco )-1;
[ Xm, sX, aX, kX ] = estatistica( Tamanhos );
yH = hist( Tamanhos, 1:25 );
yGc = Gaussiana_comparacao( Xm, sX, 1:25, 1, length(Tamanhos) );
Dif = yH - yGc;
sDif = sqrt( yGc );
ResRed = Dif ./ sDif;
%% graficar
figure

subplot( 3,1,1:2 )
hist( Tamanhos, 1:25 )
Gaussiana_comparacao( Xm, sX, 1:.1:25, 1, length(Tamanhos) )
title( sprintf( '%s media=%.1f dispersao=%.1f assimetria=%.1f kurtose=%.1f', ...
    IDIOMA, Xm, sX, aX, kX ) )
xlim( [0 26] )

subplot( 3, 1, 3 )
% errorbar( 1:25, Dif, sDif, '*-'), hold on, plot( 1:25, zeros(1,25), '-k' ), ylabel( 'Dif.' )
errorbar( 1:25, ResRed, ones(size(ResRed)), '*-'), hold on, plot( 1:25, zeros(1,25), '-k' ), ylabel( 'Res. Red.' )
% plot( 1:25, ResRed, '*-', 1:25, zeros(1,25), '-k' ), ylabel( 'Res. Red' )
xlim( [0 26] )
