?? mmono.m
字號:
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -