H = [2.5, 7.5, 12.5, 17.5, 22.5, 27.5, 32.5, 37.5;
     0.1,0.2, 0.1, 0.3, 0.1, 0.1,0.05,0.05;]

R = 180;
periodo = 0.1;
buffer = 25;
HML_HMean(H)

bar(H(1,:),H(2,:)); 
pause;




A = H(2,:);
r = 3;
b = 5;
tam = length(A);
LC = [0:tam-1]
bar(LC,A);
pause
I1 = HML_PPhi(r,inf,A)
Q1 = HML_PPhi(r,b,A)
C = [0:length(I1)-1];
bar(C,I1)
pause
I2 = HML_PPhi(r,inf,conv(Q1,A))
Q2 = HML_PPhi(r,b,conv(Q1,A))
C = [0:length(I2)-1];
bar(C,I2); 
pause
C = [0:length(Q2)-1];
bar(C,Q2); 
pause
I3 = HML_PPhi(r,inf,conv(Q2,A))
Q3 = HML_PPhi(r,b,conv(Q2,A))
pause
I4 = HML_PPhi(r,inf,conv(Q3,A))
Q4 = HML_PPhi(r,b,conv(Q3,A))
pause

[RFBH, CLR1, i] = HML_HBufferSP(H, R, buffer, periodo);
RFBH
QN = RFBH(2,:);
IN = HML_PPhi(r,inf,conv(Q1,A))
C = [0:length(IN)-1];
bar(C,IN); 
pause
C = [0:length(QN)-1];
bar(C,QN); 
pause;

bar(RFBH(1,:),RFBH(2,:)); 

