% The Hurst 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 the
% function to your satisfaction.
%
% Bill Davidson, quellen@yahoo.com
% 13 Nov 2005
% Matlab??????????
% ?????????????????
% ?????????????
function []=hurst_exponent()
disp('testing Hurst calculation');
web -browser http://www.ilovematlab.cn/thread-14631-1-1.html
n=100;
data=rand(1,n);
plot(data);
hurst=estimate_hurst_exponent(data);
[s,err]=sprintf('Hurst exponent = %.2f',hurst);disp(s);
%--------------------------------------------------------------------------
% This function does dispersional analysis on a data series, then does a
% Matlab polyfit to a log-log plot to estimate the Hurst exponent of the
% series.
%
% This algorithm is far faster than a full-blown implementation of Hurst's
% algorithm. I got the idea from a 2000 PhD dissertation by Hendrik 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 Davidson
% 21 Oct 2003
function [hurst] = 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);
hurst=p2(1); % Hurst exponent is the slope of the linear fit of log-log plot
return;
没有合适的资源?快使用搜索试试~ 我知道了~
hurst_exponent.rar_Hurst exponent_hurst
共1个文件
m:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 177 浏览量
2022-07-14
01:50:08
上传
评论
收藏 1KB RAR 举报
温馨提示
This is a programme for calculating the Hurst exponent
资源推荐
资源详情
资源评论
收起资源包目录
hurst_exponent.rar (1个子文件)
hurst_exponent.m 2KB
共 1 条
- 1
资源评论
小波思基
- 粉丝: 70
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功