LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
per.m
1function H = per(sequence,isplot)
2%
3% 'per' estimate the hurst parameter of a given sequence with periodogram
4% 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
21n = length(sequence);
22Xk = fft(sequence);
23P_origin = abs(Xk).^2/(2*pi*n);
24P = P_origin(1:floor(n/2)+1);
25
26x = log10((pi/n)*[2:floor(0.5*n)]);
27y = log10(P(2:floor(0.5*n)));
28
29% Use the lowest 20% part of periodogram to estimate the similarity.
30X = x(1:floor(length(x)/5));
31Y = y(1:floor(length(y)/5));
32p1 = polyfit(X,Y,1);
33Yfit = polyval(p1,X);
34H = (1-(Yfit(end)-Yfit(1))/(X(end)-X(1)))/2;
35
36if isplot ~= 0
37 figure,clf,hold on;
38 plot(x,y,'b.');
39 plot(X,Yfit,'r-','LineWidth',3);
40 xlabel('log10(Frequency)'),ylabel('log10(Periodogram)'),title('Periodogram Method');
41end