Question

Question: MATLAB: In a file called mywhile.m, and using the keyword while, write a function to...

Question: MATLAB: In a file called mywhile.m, and using the keyword while, write a function to find the first integer
larger than one (n) such that (2n)! > 5n.Then write a more general function, mywhile2.m, returning
the first integer such that (an)! > xn for any a and any x. Show your results for a = 3 and x = 32.

So far I have for part a i have:

%Description: This function would find the first integer larger than one
%such that (2n)! > 5^n
%Homework 1 Problem 4
num = 2;
while (num > 1)
if (factorial(2*num) <= 5^num)
break
end
num = num +1;
end
disp(num)

Please tell me where I went wrong.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Question: MATLAB: In a file called mywhile.m, and using the keyword while, write a function to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

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...

  • MATLAB Write a function called next_prime that takes a scalar positive integer input n. Use a whi...

    MATLAB Write a function called next_prime that takes a scalar positive integer input n. Use a while-loop to find and return k, the smallest prime number that is greater than n. Feel free to use the built-in isprime function (do not use nextprime). MATLAB

  • Using MatLab Write a function called PrimeFinder that receives an integer n as an input argument,...

    Using MatLab Write a function called PrimeFinder that receives an integer n as an input argument, and provides an output argument called Primes that is a vector containing all prime numbers between 2 and n, inclusive. Verify the correctness of your code with inserting 13 as the input argument, and check that your output is Primes = [2,3,5,7,11,13]. You are NOT allowed to use any directly relevant MATLAB built-in function such as divisors, etc. NOTE: A prime number is a...

  • Write a MATLAB script, which asks the user to input the angle xd (in deg) and...

    Write a MATLAB script, which asks the user to input the angle xd (in deg) and then approximates sine of the angle using the first 5 terms of Taylor series as follows: n+12n-1 sin n-1 (2n-1)! 1 Note that x in Taylor's equation is in radian, so make sure to do the conversion first Start with defining the vector n=1:5 and then use element-wise operation and basic MATLAB commands to calculate the summation. To calculate the factorial of any number,...

  • Matlab problem using newton raphson to find square root of number

    Need help modifying my Matlab script below (myscript calculates the square root of a number. using a Newton-Raphson method with 1 as the initial guess, calculates true and estimated error, and shows each iteration).-I need to create three new functions each of which should be called in the main script. These functions are needed to replace code that is currently in my script shown below.-I need to create these functions:A function to find f(x)A function to find f '(x) ?A...

  • Special Problem: Automated Factorial Create a MATLAB function called xfact that uses a loop to calculate...

    Special Problem: Automated Factorial Create a MATLAB function called xfact that uses a loop to calculate the factorial of an integer. Your function should take a single integer input. Your function should compute the factorials of every integer from 1 to the integer provided by the input. Test your function by prompting the user to enter an integer N and, using a loop create an array named X of length N that contains the factorials of the numbers 1 to...

  • Write a C program to add and subtract any two given integer numbers using pointers

    1- Write a C program to add and subtract any two given integer numbers using pointers.  2- Write a C program to find the factorial using a function and pointers.  3- Write a C program to find the square of an Integer number using a function and pointers.  4- Write a C program to find the area and perimeter of a rectangle using a function and pointers.  5- Write a C program to find the larger of two integers numbers using...

  • MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS....

    MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS. THE PROGRAM TO BE MODIFIED IS THE NEXT ONE: clc clear % Approximate the value of e ^ x using the Taylor Series x = input( 'Enter the value of x for e^x. x = ' ); t = input( 'Enter the amount of desired terms. t = ' ); i = 1; e_taylor = 0; % initializing the variable for the accumulator while...

  • This basic problem demonstrates the while-loop. (USE MATLAB) Write a Matlab function called steps that takes one scalar...

    This basic problem demonstrates the while-loop. (USE MATLAB) Write a Matlab function called steps that takes one scalar as an input argument and returns two scalars as output arguments. If it is called this way [n, d_left] = steps(d), then it sets n equal to the minimum number of steps required to move from a distance of one foot away from a wall to a distance less than d feet from the wall. The first step is 1/2 foot. If...

  • 1. Write a Matlab function to convolve two sequences objects: function y = conv(x, h) %...

    1. Write a Matlab function to convolve two sequences objects: function y = conv(x, h) % CONV Convolve two finite-length Matlab sequence objects, x and h % returning sequence object, y. When you convolve x[n] and h[n] , you may not use MATLAB's numerical conv routine. 2. write a second convolution function, conv_rt, in Matlab that basically implements a real-time convolu- tion strategy: function y = conv_rt(x, h) % Convolve two finite-length arrays, x and h % returning array, y...

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
Active Questions
ADVERTISEMENT