MATLAB program for calculating the urlst Index

Source: Internet
Author: User

% The Hirst Exponent
% --------------------------------------------------------------------------
% The first 20 lines of code are a small test driver.
% You can delete or comment out this part when you are done validating
% Function to your satisfaction.
%
% Bill David son, quellen@yahoo.com
% 13 Nov 2005

Function [] = hurst_exponent ()
Disp ('testing hustash calculation ');

N = 100;
Data = rand (1, N );
Plot (data );

Hirst = estimate_hurst_exponent (data );

[S, err] = sprintf ('hirst exponent = %. 2f ', hust'); disp (s );

% --------------------------------------------------------------------------
% This function does dispermissionanalysis on a data series, then does
% MATLAB polyfit to a log-log plot to estimate the Hirst exponent of
% Series.
%
% This algorithm is far faster than a full-blown Implementation of hurlsh's
% Algorithm. I got the idea from a 2000 PhD dissertation by Henderson Rik J
% Blok, and I make no guarantees whatsoever about the rigor of this approach
% Or the accuracy of results. Use it at your own risk.
%
% Bill David son
% 21 (Oct 2003)

Function [Hirst] = estimate_hurst_exponent (data0) % data set

Data = data0; % make a local copy

[M, npoints] = size (data0 );

Yvals = zeros (1, npoints );
Xvals = zeros (1, npoints );
Data2 = zeros (1, npoints );

Index = 0;
Binsize = 1;

While npoints> 4

Y = STD (data );
Index = index + 1;
Xvals (INDEX) = binsize;
Yvals (INDEX) = binsize * Y;

Npoints = fix (npoints/2 );
Binsize = binsize * 2;
For ipoints = 1: npoints % average adjacent points in pairs
Data2 (ipoints) = (data (2 * ipoints) + data (2 * ipoints)-1) * 0.5;
End
Data = data2 (1: npoints );

End % while

Xvals = xvals (1: Index );
Yvals = yvals (1: Index );

LogX = Log (xvals );
Logy = Log (yvals );

P2 = polyfit (logX, logy, 1 );
Urst = P2 (1); % urst exponent is the slope of the Linear Fit of log-log plot

Return;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.