Question: Using MATLAB a) Write a function called FACTRL that takes an integer and returns the factorial of N. You HAVE TO USE FOR LOOP instructions

Using MATLAB

a) Write a function called FACTRL that takes an integer and returns the factorial of N. You HAVE TO USE FOR LOOP instructions FOR THIS Function. You are not allowed to use factorial function inside your function to generate the factorial of a number. Note N!=N x (N-1) x (N-2) x . X 1

b) In a main/separate program, call FACTRL function with the following numbers N=[1 2 4 5] and find factorial of individual of N. Hint: - It might be easier to pass the number individually as oppose to an array of numbers. - It is useful to initialize the factorial inside the function to 1 before writing your loop operation.

c) PLOT Factorial of all Ns in part (b) vs. N as in part (b) d)

d) Place grid and x axis and y-axis labels on the plot.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!