?? cmxmn.m
字號:
function h=cmxmn(c)
% The function CMXMN compares the number of max-min points of data against its derivative.
%
% Calling sequence-
% h=cmxmn(c)
%
% Input-
% c - 2-D matrix of input data c(n,k)
% Output-
% h - 2-D matrix of input data h(k,4) where
% 1st column specifies the input column number,
% 2nd column specifies the number of extrema in c,
% 3rd column specifies the number of extrema in c',
% 4th column specifies the relation between 2nd and 3rd
% Z.Shen (Caltech) March, 1997 Initial
%----- Get dimensions
[n,k]=size(c);
%----- Initialize
z=zeros(k,4);
%----- Define the 1st column
z(:,1)=(1:k)';
%----- Find the number of max-min points for c and c'.
%----- Fill the output matrix
for j=1:k-1
j
j2=2;
x=c(:,j);
y=diff(x);
amx=0;
amn=0;
bmx=0;
bmn=0;
while j2<=n-2 ,
if (x(j2-1)<x(j2))&(x(j2)>=x(j2+1))
amx=amx+1; % max point
elseif (x(j2-1)>x(j2))&(x(j2)<=x(j2+1))
amn=amn+1; % min point
end
if (y(j2-1)<y(j2))&(y(j2)>=y(j2+1))
bmx=bmx+1; % max point
elseif (y(j2-1)>y(j2))&(y(j2)<=y(j2+1))
bmn=bmn+1; % min point
end
j2=j2+1;
end
z(j,2)=amx+amn;
z(j,3)=bmx+bmn;
z(j,4)=(amx+amn)/(bmx+bmn);
end
h=z;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -