matlab求dfa指数,关于使用MF-DFA方法计算广义Hurst指数的MATLAB操作问题

我在论坛上复制了一个代码,是使用MF-DFA方法计算广义Hurst指数的,但不知道需填入的各个变量的名称,我是零基础,但任务时间很紧,来不及现学,所以想先用来算个数,请各位高手指教,不胜感激!

请问括号中的signal,m,scmin,scmax,ressc,qmin,qmax,qres各自是什么意思,都应该填写什么?最好能举个例子,实在是不胜感激!!!

具体代码如下:

function [s,q,Hq,h,Dh,logFq]=MFDFA(signal,m,scmin,scmax,ressc,qmin,qmax,qres)

%

% Multifractal detrended fluctuation analysis (MFDFA)

%

% [s,q,Hq,h,Dh,logFq]=MFDFA(signal,m,scmin,scmax,ressc,qmin,qmax,qres);

%

% INPUT PARAMETERS-----------------------------------------------------

%

% signal:       input signal

% m:            polynomial order for the detrending

% scmin:        lower bound of the window size s

% scmax:        upper bound of the window size s

% ressc:        number of elements in s

% qmin          lower bound of q

% qmax          upper bound of q

% qres          number of elements in q

%

% OUTPUT VARIABLES-----------------------------------------------------

%

% s:            scale

% q:            q-order

% Hq:           q-generalized Hurst exponent

% logFq:        q-generalized scaling function F(s,q) in log coordinates

% lin_fit       linear least square fit to logFq

% h:            H鰈der exponent

% Dh:           Multifractal spectrum

%

% EXAMPLE-----------------------------------------------------

%

% T=40.96 ; rmin=0.02 ; Dt=rmin/2 ; Law=0 ; ParamLaw1=0.2; ParamLaw2=0; C=1 ; q1=(-10:10)/2;

% [Qr1,time,TtheoQ,q] = IDCnoise_epl(T,rmin,Dt,Law,ParamLaw1,C,q1);

% [Qr2,time,TtheoQ,q] = IDCnoise_epl(T,rmin,Dt,Law,ParamLaw2,C,q1);

% H=0.75 ; oversamprate = 16 ; printout = 0;

% [Ar,VH1,BH] = synthArVH(H,Qr1,Dt,oversamprate,printout) ;

% [Ar,VH2,BH] = synthArVH(H,Qr2,Dt,oversamprate,printout) ;

% [s,q,Hq1,h1,Dh1,logFq1]=MFDFA(diff(VH1),1,10,200,40,-3,3,61);

% [s,q,Hq2,h2,Dh2,logFq2]=MFDFA(diff(VH2),1,10,200,40,-3,3,61);

% figure;

% subplot(311)

% plot(1:4096,diff(VH1),'b-',1:4096,diff(VH2),'r-');xlabel('time');

% ylabel('amplitude'); title('multiplicative cascading noise \DeltaB_H(A(t))and fractional Gaussian noise \DeltaB_H(t)');

% legend('\DeltaB_H(A(t))','\DeltaB_H(t)');

% subplot(323);

% plot(log2(s),logFq1(:,1:5:end),'b-');hold all

% plot(log2(s),logFq2(:,1:5:end),'r-');

% xlabel('log_2(\Deltat)');ylabel('log_2(F_\Delta_t(q))');title('log-scaling function')

% subplot(324)

% plot(q,Hq1,'bo-',q,Hq2,'ro-');xlabel('q'); ylabel('H(q)'); title('q-generalized Hurst exponent');

% legend('\DeltaB_H(A(t))','\DeltaB_H(t)');

% subplot(325)

% plot(h1, Dh1,'bo-',h2, Dh2,'ro-');xlabel('h(q)');ylabel('D(h)');title('multifractal half-spectrum');

% legend('\DeltaB_H(A(t))','\DeltaB_H(t)');

%

% ---------------------------------------------------------------

% Written by Espen A. F. Ihlen (espen.ihlen@ntnu.no), 2009

warning off;

Fluct=cumsum(signal-mean(signal)./std(signal));

FluctRev=fliplr(Fluct);

N=length(Fluct);

ScaleNumb=linspace(log2(scmin),log2(scmax),ressc);

s=round(2.^ScaleNumb);

q=linspace(qmin,qmax,qres);

znumb=find(q==0);

Fq=zeros(length(s),length(q));

for ns=1:length(s),%disp(strcat('computing scale number_',num2str(ns)));

Ns=floor(s(ns)\N);

Var=zeros(Ns,length(q));

Varr=zeros(Ns,length(q));

for v=1:Ns,

SegNumb=((((v-1)*s(ns))+1):(v*s(ns)))';

Seg=Fluct(SegNumb);

SegRev=FluctRev(SegNumb);

poly=polyfit(SegNumb,Seg,m);

polyr=polyfit(SegNumb,SegRev,m);

fit=polyval(poly,SegNumb);

fitr=polyval(polyr,SegNumb);

for nq=1:length(q);

Var(v,nq)=((sum((Seg-fit).^2))/s(ns))^(q(nq)/2);

Varr(v,nq)=((sum((SegRev-fitr).^2))/s(ns))^(q(nq)/2);

end;

clear SegNumb Seg SedRev poly polyr fit fitr

end

for nq=1:length(q)

Fq(ns,nq)=((sum(Var(:,nq))+sum(Varr(:,nq)))/(2*Ns))^(1/q(nq));

end

Fq(ns,znumb)=(Fq(ns,znumb-1)+Fq(ns,znumb+1))./2;

clear Var Varr

end

logFq=log(Fq);

Hq=zeros(1,length(q));

lin_fit=zeros(length(s),length(q));

for nq=1:length(q);

P=polyfit(log(s),logFq(:,nq),1);

lin_fit(1:length(s),nq)=polyval(P,log(s));

Hq(nq)=P(1);

end;

tau=(q.*Hq)-1;

hh=diff(tau)./(q(2)-q(1));

Dh=(q(1:(end-1)).*hh)-tau(1:(end-1));

h=hh-1;

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值