Home » All Programs » Factorial Calculation In MatLab

Factorial Calculation In MatLab

Factorials are very important aspect of calculus. And engineers are generally calculates calculus problems in Matlab. You can calculate the factorials of various kinds of vectors and matrices in Matlab easily with ‘factorial()’ command in Matlab. In here, we explain how to calculate the factorials in Matlab with ‘factorial()’ command.

How To Use ‘factorial()’ Command In MatLab?

a = [2 6 3 6];
b = [5 3 4 6; 4 6 3 6; 4 8 9 3];
x = factorial(a)
y = factorial(b)
z = factorial(10)

As you see in above code in Matlab, we created a vector called ‘a’ and a matrix called ‘b’. The use of ‘factorial()’ command is very simple as you see. Just write the thing inside paranthese of factorial() command to calculate its factorial.

You can assign the factorial() command to a variable, or you directly calculate different factorials in command window of Matlab by writing it without asignment.

x =

     2   720     6   720


y =

         120           6          24         720
          24         720           6         720
          24       40320      362880           6


z =

     3628800

You can see the results above in Matlab Command Window. The factorial calculation of vector ‘a’ is done for all elements respectively. The same thing is valid for also matrix ‘b’.

You can also calculate the factorial of a number, just like we calculated the factorial of 10.

Here is the use of factorial() command is very easy to calculate factorials of different things in Matlab.

YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!

Do not forget to leave your comments and questions about factorial calculation in Matlab below. Your precious feedbacks are very important for us.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Please

leave feedback ?

( For the post )

ASK THE MECHANICALLAND

COMMUNITY


We are always open to your feedback to improve ourselves and the quality of our content! If you have any suggestions, thoughts, or criticism, please let us know. We are trying to improve our blog with constructive feedback. We are aware of how valuable your feedback is for our future development, and we will carefully read all your comments. Thank you in advance!