zmax.m

来自「一种新的时频分析方法的matlab源程序。」· M 代码 · 共 32 行

M
32
字号
function h=zmax(x)
%
% h=zmax(x):
%
% Function to extract the set of max points of a 1-D data. 
%
% Input-
%	x	- vector of input data x(n)
% Output-
%	z	- vector that specifies the values of max points
%
% Z.Shen (Caltech)		May, 1997 Initial
% Jelena Marshak (NASA GSFC)	March 9, 2004 Edited
%

%----- Get dimensions
n=length(x);

%----- Initialize
n_x=1;
h=0;

for i=2:n-1
   if (x(i-1)<x(i))&(x(i)>=x(i+1))
      h=[h x(i)];
      n_x=n_x+1;
   end
end

%----- Define the output
h=h(2:n_x);
h=h';

⌨️ 快捷键说明

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