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

📄 args.m

📁 matlab算法集 matlab算法集
💻 M
字号:
function y = args (x,a,b,k,f)
%-----------------------------------------------------------------------
% Usage:       y = args (x,a,b,k,f) 
%
% Description: Check to see if a scalar calling argument is out of range
%
% Inputs:      x = scalar to be checked
%              a = minimum value of x
%              b = maximum value of x
%              k = argument number
%              f = string containing function name
%
% Outputs:     y = x saturated to the interval [a,b]
%-----------------------------------------------------------------------
if x < a
   y = a;
   fprintf ('\nArgument %i of function %s was too low.  Its value',k,f)
   fprintf ('\nwas set to %g.\n',y)
elseif x > b  
   y = b;
   fprintf ('\nArgument %i of function %s was too high.  Its value',k,f)
   fprintf ('\nwas set to %g.\n',y)
else
   y = x;
end
%-----------------------------------------------------------------------


⌨️ 快捷键说明

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