Question

MATLAB code question. Please keep is basic P4.3.6 What is the smallest value of n such...

MATLAB code question. Please keep is basic

P4.3.6 What is the smallest value of n such that the value of factorial(n) is inf?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
n = 1;
while true
    f = 1;
    for i=1:n
        f = f*i;
    end
    if f == Inf
        fprintf("Smallest value of n for which factorial is inf is %d\n", n)
        break;
    end
    n = n+1;
end

Smallest value of n for which factorial is inf is 171

Add a comment
Know the answer?
Add Answer to:
MATLAB code question. Please keep is basic P4.3.6 What is the smallest value of n such...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • photo of the code please and an explnation if possible, Construct a simple MATLAB function program...

    photo of the code please and an explnation if possible, Construct a simple MATLAB function program my_factorial which calculates product of first n positive integer numbers (i.e. find factorial n!). For full points: - Make sure you protect the code from illogical use (n must be positive integer) - Test the function by comparing with built in MATLAB function factorial(n) - Make sure you test your function for any limitations. O marks) -3. Using my factorial function from the previous...

  • Please provide MATLAB code and comments! Please provide MATLAB code and comments! Please provide MATLAB code...

    Please provide MATLAB code and comments! Please provide MATLAB code and comments! Please provide MATLAB code and comments! Question #5. Write a script that creates a variable called BALANCE that is assigned the value 100.00. Then prompt the user to enter an amount to withdraw. Store that amount in a variable called WITHDRAW. Use an if/else construct to display a message to the user stating whether the withdrawal was successful. If the withdrawal would result in a negative balance, state...

  • Write a MATLAB script, using either a single or nested for-loop, that will print the factorials...

    Write a MATLAB script, using either a single or nested for-loop, that will print the factorials for the numbers between 1 and 100 (inclusive). The factorial of n (n!) is the product of the positive integers less than or equal to n. For example: 3! = 3 * 2 * 1. For this question you cannot use the built-in MATLAB factorial function, but you can use other MATLAB functions if you wish. MATLAB code!MATLAB code!MATLAB code!MATLAB code!

  • I need a matlab code for given question. Please send matlab code sctript. a:2 b:3: c:4...

    I need a matlab code for given question. Please send matlab code sctript. a:2 b:3: c:4 d:2.1 e:3.1 Question 1) (60 p) Consider following equation: axt-bx'+ex=dx-e Find the value of x via; a) Fixed Point iteration method with an accuracy of 0.0004 and a starting value of 1. b) Newton's Method with an accuracy of 0.0004 and a starting value of 1. Write the codes and the results to your paper.

  • solve using Matlab , write the matlab code please 2.95. A DVD drive is mounted chassis...

    solve using Matlab , write the matlab code please 2.95. A DVD drive is mounted chassis and is modeled as a single-degree-of-freedom on a spring, mass, and damper. During normal operation, the drive (having a mass of 0.4 kg) is subject to a harmonic force of 1 N at 10 rad/s. Because of material considerations and static deflection, the stiffness is fixed at 500 N/m and the natural damping in the system is 10 kg/s. The DVD player starts and...

  • for this matlab code what is the value of ires at the end of the code?...

    for this matlab code what is the value of ires at the end of the code? ires = 0; for index = 10:-2:4 if index == 6 break; end ires = ires + index; end

  • cope the code please thanks Write a MATLAB code to obtain the following. Keep your code...

    cope the code please thanks Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...

  • Question 1: 1. Figure out what the following MATLAB code does (Notice that R n =...

    Question 1: 1. Figure out what the following MATLAB code does (Notice that R n = 500 for jay - 1:4 ifjoy > 1;oldtime = time; end M rand(n); t cputime; forrep -1:5 R chol(A): en time = cputime-t; if jay > 1; ratio - time/oldtime, end en If you put these instructions into a file named, say, zap.m, you can run the program by typing zap from the MATLAB command line. The functions randn, cputime, and chol are built-in...

  • Please write code using MATLAB (4pts) Use the limit function to compute the following limits a)...

    Please write code using MATLAB (4pts) Use the limit function to compute the following limits a) lim b) compute the limit lim-, vIn! a*-1 d) compute the limit lim c) lim xsin (use the factorial function in 'b')

  • Please provide the Matlab code along with the inference. Also please confirm the answer from matlab...

    Please provide the Matlab code along with the inference. Also please confirm the answer from matlab code with numerical analysis. Determine and plot the response of the system shown in Fig. 4 using MATLAB. The response is xo(t) when the input xi(t) is a unit step displacement input. The parameters of the system are ki = 15 N/m, k2= 25 N/m, ci = 7 N-s/m, c2 = 15 N-s/m. X(t) ye Fig. 4

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT