reldisp.m

来自「biomedical stuffs...」· M 代码 · 共 25 行

M
25
字号
function hcoeff=reldisp(x)
%	hcoeff=reldisp(x)
%	This program is distributed as a supplement to the book
%	"Biomedical Signal Processing and Signal Modeling" by E. N. Bruce,
%	published by Wiley, 2000.  It is provided for educational use only.
%  While every effort has been made to insure its suitability to illustrate
%  principles described in the above book, no specific feature or capability 
%  is implied or guaranteed.
%
mmax=floor(log(length(x))/log(2));
sd(1)=std(x,1);
y=x; nsk=2;nl=2*floor(length(y)/2);
for m=2:mmax-nsk
   j=0;
   for k=1:2:nl
      j=j+1;
      y(j)=(y(k)+y(k+1))/2;
   end
   sd(m)=std(y(1:j),1);
   nl=j;
end
plot([0:mmax-1-nsk],log(sd(1:mmax-nsk))/log(2),'.')
slope=tls([0:mmax-1-nsk]',log(sd(1:mmax-nsk)')/log(2));
xlabel('log2(m)');ylabel('log2(SD(m))')
hcoeff=1+slope;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?