modulusmaxima.sci

来自「小波分解源代码」· SCI 代码 · 共 40 行

SCI
40
字号
function localmaxima = ModulusMaxima(m,par,ABS,threshold)
//  Copyright Aldo I Maalouf
[lhs,rhs]=argn();
coef = 0;
coef2 = 0; 
if rhs < 3, 
	ABS = 1;
 end;
 
 if rhs < 2,
	par = 1;
 end;
 
 if ABS,
	m = abs(m);
 end;

 [nrows,ncols] = size(m);
 localmaxima   = zeros(nrows,ncols);

 t      = 1:nrows;
 tplus  = rshift(t);
 tminus = lshift(t);

 for i = 1:ncols,
 	x = ShapeAsRow(m(:,i));
	for j = 1:par,
		x = max([x(t); x(tplus); x(tminus)],'r');
	end;

	x = ShapeAsRow(x)';
	localmaxima(:,i) = (~(m(:,i)<x));
	coef = coef + length2(find(localmaxima(:,i)));
	localmaxima(:,i) = localmaxima(:,i) .* (abs(m(:,i))>threshold);
	coef2 = coef2 + length2(find(localmaxima(:,i)));
 end;
 endfunction

  

⌨️ 快捷键说明

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