⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locmin.m

📁 一种新的时频分析方法的matlab源程序。
💻 M
字号:
function z=locmin(x)
%
% z=locmin(x):
%
% Function to identify local maxima points of a physical signal
% and their coordinates.
%
% Input-
%	x		- input vector of values
% Output-
%	z		- 2-D matrix z(m,2) where 
%			 1st column specifies the coordinates 
%			  of min values in the order found
%			 2nd column specifies the corresponding min values
%
% Jelena Marshak (NASA GSFC)	March 9, 2004 Edited

%----- Find the input data length
nn=length(x);
w=zeros(nn,2);

%----- Initialize values
d_tp=0;				%temple index of possible max, min
d_i=1;				%corresponding t
if(x(1)==x(2) & x(2)>x(3))	%initialize d_tp
   d_tp=1;
end

count=0;

%----- Find the extrema
for i=3:nn-2
   if (x(i-1)>x(i) & x(i)<x(i+1))
      count=count+1;
      w(count,1)=i;
      w(count,2)=x(i);
   elseif(x(i-1)==x(i) & x(i)<x(i+1))
      if(d_tp>0)
			count=count+1;
			w(count,1)=ceil((d_i+(i-d_i)/2));
         w(count,2)=x(ceil(d_i+(i-d_i)/2));
         d_tp=0;
      end
   elseif(x(i)<x(i-1) & x(i)==x(i+1))
		d_tp=1;
      d_i=i;
   end
end

if(x(nn-1)==x(nn))		%end-condition
	if(d_tp>0)
		count=count+1;
		w(count,1)=ceil((d_i+(nn-d_i)/2));
      w(count,2)=x(ceil(d_i+(nn-d_i)/2));
   end
end

z=zeros(count,2);
for i=1:count
   z(i,1)=w(i,1);
   z(i,2)=w(i,2);
end

⌨️ 快捷键说明

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