In the following example, let us take a 2 X 2 array. Next, we will understand how to take the factorial of an array. So, our output is the product of all whole numbers less than and equal to our input (excluding zero). This is how our input and output will look like in MATLAB console: Let us first take a simple example of calculating the factorial of a whole number. Now let us understand the computation of factorial in MATLAB with various examples: Generally, it is represented as n! in maths but in MATLAB it will be written as f =factorial(n).Let us consider ‘n’ to be an array, then function ‘f’ will result in factorial of all values which are part of array ‘n’.The size of the output array and its data type will be same as of input array ‘n’.Here n is a non-negative integer value and this function will result in a product of all positive integers whose value will either be equal to ‘n’ or less than ‘n’.Hadoop, Data Science, Statistics & othersį= factorial(n) Description of Factorial Function in Matlab
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |