from
Rescaled Range Analysis
by Kirill Petukhov
My implementation of the Hurst`s Rescaled Range Analysis. Test file included.
|
| rs.m |
clear;
clc;
Z=load('inputtest.txt'); %
m=length(Z); %
x=zeros(1,m); %
y=zeros(1,m);
y2=zeros(1,m);
for tau=3:m
X=zeros(1,tau);
Zsr=mean(Z(1:tau)); %
for t=1:tau
X(t)=sum(Z(1:t)-Zsr); %
end;
R=max(X)-min(X); %
S=std(Z(1:tau),1); %
H=log10(R/S)/log10(tau/2); %
x(tau)=log10(tau); %
y(tau)=H; % H-
y2(tau)=log10(R/S); % RS-
end;
plot(x,y,'k--',x,y2,'k-'),legend('H-track','R/S-track','Location','South')
xlabel('lg(number of test)'),ylabel('lg(R/S)')
axis([x(1) x(end) -inf +inf]),drawnow
figure(gcf)
|
|
Contact us at files@mathworks.com