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

📄 isconstant.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
字号:
function bool=isconstant(a,epsilon)% Function checks if all elements of array "a" are the same within% limits median(a)*(1 +/- epsilon) (relative error) or,% if median(a) < eps, within limits +/- epsilon (absolute error).%% Written by: E. R.: November 14, 2005% Last updated:%%          bool=isconstant(a,epsilon)% INPUT% a        numeric vector or matrix% epsilon  maximum relative deviation %          Default: epsilon = 0% OUTPUT% bool     logical variable%          true if all entries of "a" are the same within the limits%          false  otherwiseif nargin == 1  |  epsilon == 0   if all(a == a(1))      bool=logical(1);   else      bool=logical(0);   endelse   ma=median(a);   if abs(ma) < eps      meps=abs(epsilon);   else      meps=abs(ma*epsilon);   end   if all(a <= ma+meps)  &  (a >= ma-meps)      bool=logical(1);   else      bool=logical(0);   endend

⌨️ 快捷键说明

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