Question: MATLAB needed Taylor Series Objective: In the following program the student is to demonstrate knowledge and use of convergence using while. For the Taylor Series

MATLAB needed Taylor Series Objective: In the following program the student is to demonstrate knowledge and use of convergence using while. For the Taylor Series concept see Taylor_Series document. To compute any Taylor Series, realize that the series is an infinite series; therefore we must find a way to end the series. Since this series has the factorial as a denominator in the item called Term therefore that fraction will eventually get extremely small because factorial grows very fast and very large. Focus on the item called Term in the theory discussion. Term is the actual equation for a single term of the series; the answer is the summation, via a while loop, of all of the terms. How do we terminate this loop since the number of loops in not deterministic? Since Term eventually becomes very small we will choose to compare each Term to epsilon, when the Term is less than epsilon we stop the loop. The answer then is accurate to within epsilon. NOTE, that when the Term has alternating signs, the Term must be in an Absolute Value form when compared to epsilon. NOTE: These Trigonometry functions using Taylor Series assume angle is in radians.

Requirements:

1. Write a Function Main and 3 embedded functions. Remember for embedded functions, there are no scripts.

2. This program is to cycle repeatedly until the user chooses to stop.

3. The user will choose to calculate sine, cosine, or sinh. It is important that all of the inputs and outputs to and from the user are done in the main function not in the working functions.

4. The user should input their choice of the function, the angle and epsilon from the theory equations.

5. Write 3 functions that calculate the Sine, Cosine, and Sinh respectively. The parameters for these functions are the angle, epsilon, and i. The functions output is the answer.

6. When the function returns the answer, you are to output the answer and i after the function runs. This value of i will be the number of loops required to reach epsilon. Functions should be very narrow in what they are doing BUT also all inclusive of the singular task, using the parameters so that the function can be reused.

7. In the Main Script check your results by using the respective corresponding standard Matlab functions.

8. Submit a table showing your results compared to the Matlab functions using 3 different epsilons, 10^-3, 10^-6, and 10^-12. Regarding factorial, as the i gets larger factorial may fail, force i to be double and it should work. The problem is that the factorial can exceed the integer size in the computer. Matlab has the built in function factorial below is a function I wrote that solves factorial in a recursive way. You can use either one.

function [F ]= FACT(x)

if (x <= 1) F = 1

else F = x * FACT(x - 1)

end

end

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!