fracssm.m

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

M
30
字号
function sigf=fracssm(H,ordr,npts)
%  sigf=fracssm(H,ordr,npts)
%  sigf is a fractal signal with Hurst coefficient H
%  ordr is the number of frequencies to include
%  npts is the length of sigf
%
%	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.

beta=1+2*H; sigf=zeros(npts,1);
A=zeros(ordr/2,1); B=zeros(ordr/2,1);
for j=1:ordr/2
	P=j^(-beta/2)*randn;
	Q=2*pi*rand;
	A(j)=P*cos(Q);
	B(j)=P*sin(Q);
end
td=2*pi/npts;
for k=1:npts
	temp=0.;
	for j=1:ordr/2
		temp=temp+A(j)*cos(j*k*td)+B(j)*sin(j*k*td);
	end
	sigf(k)=temp;
end

⌨️ 快捷键说明

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