Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 ( 6 0 points ) This question requires you to write a MATLAB script that includes the following functions, and will perform the
Question points
This question requires you to write a MATLAB script that includes the following functions, and will perform
the steps listed below the functions. Do not use any builtin MATLAB functions for this task.
Functions:
Write a function named Factorsnum that takes an integer and returns an array of all possible
factors of the num as well as the time in microseconds it took to compute it For example, if num is
the function should return and and computation time.
Write a function named Factorialnum that takes an integer as an argument and returns its
factorial as well as the time in microseconds it took to compute the factorial. For example, if num is
the function should return and computation time.
Write a function named PrimeNumbersnum that takes an integer as an argument and returns an
array of all prime numbers less than or equal to num as well as the time in microseconds it took to
compute it
Script: Your script should perform the following steps:
After receiving input from the user, the program should check whether the input is between and
If the number passes this condition, the script should continue its other steps. If the condition is
not met, the script should output The input is not between and and ask the user for input
again.
In the next step, the program should check whether the input is indeed an integer and not a prime
number. If the input is not an integer, it should be rounded up to the next integer. If the input is a
prime number, add to make it nonprime.
Call your Factorsnum function and print the array and computation time.
Call your Factorialnum function and print the result and computation time.
Call your PrimeNumbersnum function and print the result and computation time.
plot all three times using a bar graph.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started