FACTORIALM

Factorial function for matrices
1.9K Downloads
Updated 23 Jan 2007

View License

-------------------
This is an extension of factorial.m in Matlab R13, for matrices. It is inspired by a post on CSSM.
-------------------

F = FACTORIALM(M) returns the factorial for all integers of the matrix M.
So,F(i) is the product of all integers from 1 to M(i), i.e. prod(1:M(i)).
F has the same size as M. NaNs and Infs in M will yield NaNs in F.

Example:
factorialm([1 6 0 ; NaN 4 -Inf])
will return : 1 720 1
NaN 24 NaN

Created for MatLab 13.
Last update: jan 23, 2007

Cite As

Jos (10584) (2024). FACTORIALM (https://www.mathworks.com/matlabcentral/fileexchange/13746-factorialm), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Logical in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0