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

📄 factorial.m

📁 《Radar Systems Analysis and Design Using MatLab》
💻 M
字号:
function p = factorial(n)
%FACTORIAL Factorial function.
%   FACTORIAL(N) is the product of all the integers from 1 to N,
%   i.e. prod(1:N). Since double precision numbers only have about
%   15 digits, the answer is only accurate for N <= 21. For larger N,
%   the answer will have the right magnitude, and is accurate for 
%   the first 15 digits.
%
%   See also PROD.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.2 $

if (length(n)~=1) | (fix(n) ~= n) | (n < 0)
  error('N must be a positive integer'); 
end

p = prod(1:n);

⌨️ 快捷键说明

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