Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a function that determines whether a number is odd or even. 2. Write a function that implements the factorial functionality using loops. 3.
1. Write a function that determines whether a number is odd or even. 2. Write a function that implements the factorial functionality using loops. 3. A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1,1 and proceeds as follows: 1,1,2,3,5,8,13, However, a Fibonacci sequence can be created with any two starting numbers. a. Prompt the user to enter the first two numbers in a Fibonacci sequence and the total number of elements requested for the sequence. Find the sequence and store it in an array by using a while loop. b. Perform three testing scenarios in the command window. 4. A store owner asks you to write a program for use in the checkout process. The program should: - Prompt the user to enter the cost of the first item. - Continue to prompt for additional items, until the user enters 0 . - Display the total. - Prompt for the dollar amount the customer submits as payment. - Display the change due. a. Test the program with three different testing scenarios. 5. For the following Taylor series ex=n=0Nn!xn=1+x+2!x2+3!x3+4!x4+,N= a. Create a MATLAB function, named my_f1_loops, that will accept x and N as inputs and produce one output, corresponding to the approximated value of exp(x) given in the equation above. You must use for-loops. b. Write a MATLAB script called q3_testing and test your function for x=1 and N=5 and store the result in a variable named test1. c. In q3_testing, for x=1, call the my_f1_loops function five times, corresponding to N= 0,1,2,3, and 4 . Use a for-loop to solve this part and store the result of the function calls in an array named test 2 . d. In q3_testing, plot a bar graph showing the absolute error difference between the results for all calls and the actual value of ex. Add a descriptive title and labels
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