Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2010-01-02, 13:38   #1
doublee
初级会员
 
注册日期: 2009-12-02
帖子: 1
声望力: 0
doublee 正向着好的方向发展
默认 求教!关于Hurst指数

我在论坛上搜到了求Hurst指数的代码,但是用的时候总是出现下面这个问题:
>> estimate_hurst_exponent(data0)
Warning: Polynomial is not unique; degree >= number of data points.
> In polyfit at 72
In estimate_hurst_exponent at 36

ans =

0
请高手不吝赐教!
我的数据:
0.9411
1.0931
1.1259
0.9026
0.9983
1.1045
1.0186
0.9405
1.0181
0.9603
1.0044
1.0253
0.8526
1.2328
1.0344
0.9079
1.0055
1.0472
1.0856
0.9161
1.0222
0.9894
1.0872
0.9087
0.9599
0.7679
1.4795
0.9754
1.0099
1.0674
Hurst指数的代码:
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

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;

此帖于 2010-01-02 13:43 被 doublee 编辑。 原因: 不是原始代码
doublee 当前离线   回复时引用此帖
回复

主题工具
显示模式

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 17:21


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.