📄 est_h_mad.m
字号:
function [H,sigma] = est_H_mad(x)
%
% function [H,sigma] = est_H_mad(x)
%
% This program calculates the fractal dimension of an input signal
% f(n) as described in the article 'Fractal-Based Description of
% Natural Scenes' by Alex Pentland in IEEE Transactions on Pattern
% Analysis and Machine Intelligence, Nov. 1984.
%
% Programmed by: Stephen M. Kogon, 1996
%
%-----------------------------------------------------------
% Copyright 2000, by Dimitris G. Manolakis, Vinay K. Ingle,
% and Stephen M. Kogon. For use with the book
% "Statistical and Adaptive Signal Processing"
% McGraw-Hill Higher Education.
%-----------------------------------------------------------
N=length(x);
maxscale=min(round(0.1*N),100);
% Find the expected values of the absolute value of x(x + delta) - x(x)
% for delta = 1 to maximum scale.
for delta=1:maxscale
scale(delta)=delta;
expdif(delta)=(1/(N-delta))*sum(abs(x(1+delta:N)-x(1:N-delta)));
end
% Create the self-similarity plot, with the initial estimate of the fit
c_init = polyfit(log(scale),log(expdif),1);
fit_init = polyval(c_init,log(scale));
%loglog(scale,expdif,'.',scale,exp(fit_init)); grid;
plot(log(scale),log(expdif),'.',log(scale),fit_init);grid
d_est = 2 - c_init(1);
sigma=c_init(2);
H=2-d_est;
title(['Estimated H = ',num2str(H)]);
xlabel('Scale log_e(\Delta)');
ylabel('log_e[E\{|x(n+\Delta) - x(n)|\}]');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -