LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
matlab
lib
thirdparty
hurst_estimators
hurst_estimator
higuchi.m
1
function H = higuchi(sequence,isplot)
2
%
3
%
'higuchi'
estimate the hurst parameter of a given sequence with
4
% higuchi
's method.
5
%
6
% Inputs:
7
% sequence: the input sequence for estimate
8
% isplot: whether display the plot. without a plot if isplot equal to 0
9
% Outputs:
10
% H: the estimated hurst coeffeient of the input sequence
11
12
% Author: Chu Chen
13
% Version 1.0, 03/10/2008
14
% chen-chu@163.com
15
%
16
17
if nargin == 1
18
isplot = 0;
19
end
20
21
sequence = cumsum(sequence);
22
N = length(sequence);
23
mlarge = floor(N/5);
24
M = [floor(logspace(0,log10(mlarge),50))];
25
M = unique(M(M>1));
26
n = length(M);
27
cut_min = ceil(n/10);
28
cut_max = floor(6*n/10);
29
30
curve_length = zeros(1,n);
31
for h = 1:n
32
m = M(h);
33
k = floor((N-m)/m);
34
temp_length = zeros(m,k);
35
36
for i = 1:m
37
for j = 1:k
38
temp_length(i,j) = abs(sequence(i+j*m)-sequence(i+(j-1)*m));
39
end
40
end
41
42
curve_length(h) = sum(mean(temp_length,2)) * ((N-1)/m^3);
43
end
44
45
x = log(M);
46
y = log(curve_length);
47
X = x(cut_min:cut_max);
48
Y = y(cut_min:cut_max);
49
p1 = polyfit(X,Y,1);
50
Yfit = polyval(p1,X);
51
yfit = polyval(p1,x);
52
H = 2 + (Yfit(end)-Yfit(1))/(X(end)-X(1));
53
54
if isplot ~= 0
55
figure,hold on;
56
plot(x,y,'
b*
');
57
plot(X,Yfit,'
r-
','
LineWidth
',2);
58
plot(x(1:cut_min),yfit(1:cut_min),'
r:
','
LineWidth
',2);
59
plot(x(cut_max:end),yfit(cut_max:end),'
r:
','
LineWidth
',2);
60
xlabel('
Log10(Aggregate Level)
'),ylabel('
Log10(Curve Legnth)
'),title('
Higuchi Method
');
61
end
Generated by
1.9.8