 # Question & Answer: Write your own function for calculation of the number of combinations of r items out of n items. You need…..

matlab
please write a program in matlab suppose there is no built in function for factorial in matlab.come up with ur own function for factorial

Write your own function for calculation of the number of combinations of r items out of n items. You need to use your own factorial function, and then use this function for calculation: n! 7l

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Write your own function for calculation of the number of combinations of r items out of n items. You need…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

Factorial funtion to find number of possibilities.

Matlab Code Screenshot: Sample Output: Code to Copy:

% Read the input as cobminations from keybaord
r=input(‘Enter number of Combinations :’);

% Read the input as total from keybaord
n=input(‘Enter number of items :’);

% Calculate the number of combinations as per the Given formula.
fact1=factorial(n);
fact3=factorial(r);
sub=factorial(minus(n,r));
total=fact1 / (sub * fact3);

% Display the output.
fprintf(“Total number of possibilities are: % in”,total);