function [HX,HY]=Hurst(ARG,step,ratio)

if nargin==2
    isRatio=0;
else
    isRatio=1;
end

[m,n]=size(ARG);
if (n==1)
    ARG=ARG';
    [m,n]=size(ARG);
end

index=1;
thau=n;
% step=50;
HX(1)=thau;
HY(1)=0;
while (thau>8)
    TEMP=getRS(ARG,thau);
    if (TEMP~=0)
        HX(index)=thau;
        HY(index)=TEMP;
        index=index+1;
    end
    if isRatio==1
        thau=fix(thau/ratio);
    else
        thau=thau-step;
    end
end

%HXLog=log(HX);
%HYLog=log(HY);
%[a,b]=MinSquare(HXLog,HYLog);
%loglog(HX,HY);
%figure
%plot(HX,HY);
%a