mmono.m
来自「Matlab 6.0图形图像处理所附带的光盘」· M 代码 · 共 28 行
M
28 行
function f=mmono(x)%MMONO Test for Monotonic Vector.% MMONO(X) where X is a vector returns:% 2 if X is strictly increasing,% 1 if X is non decreasing,% -1 if X is non increasing,% -2 if X is strictly decreasing,% 0 otherwise.% D.C. Hanselman, University of Maine, Orono, ME, 04469% 2/7/95% Copyright (c) 1996 by Prentice-Hall, Inc.x=x(:); % make x a vectory=diff(x); % find differences between consecutive elementsif all(y>0) f=2; % test for strict firstelseif all(y>=0) f=1;elseif all(y<0) f=-2; % test for strict firstelseif all(y<=0) f=-1;else f=0; % default responseend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?