LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
higuchi.m
1function 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
17if nargin == 1
18 isplot = 0;
19end
20
21sequence = cumsum(sequence);
22N = length(sequence);
23mlarge = floor(N/5);
24M = [floor(logspace(0,log10(mlarge),50))];
25M = unique(M(M>1));
26n = length(M);
27cut_min = ceil(n/10);
28cut_max = floor(6*n/10);
29
30curve_length = zeros(1,n);
31for 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);
43end
44
45x = log(M);
46y = log(curve_length);
47X = x(cut_min:cut_max);
48Y = y(cut_min:cut_max);
49p1 = polyfit(X,Y,1);
50Yfit = polyval(p1,X);
51yfit = polyval(p1,x);
52H = 2 + (Yfit(end)-Yfit(1))/(X(end)-X(1));
53
54if 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');
61end