Info

# Compare the result of trig functions from the built-in Matlab Functions

1 view (last 30 days)
Jared Martin on 21 Apr 2015
Commented: James Tursa on 21 Apr 2015
Write a program that will compare the result of trig functions from the built-in Matlab Functions with the value computed for that function using Taylor series. The objective of the program is to compute a value for a given x using the built in math functions, cos(x); sin(x); exp(x). Then compute these functions on your own using the formulas given in Equation 5. The comparison will be made by simply subtracting your computed version from the built-in version of the result. Running the summations an infinite amount would result in a perfect representation of the function. For this program, we will use 3 4 radians as the value for x, And the summations will be taken out to 2, 5, 10 and 30 terms. As an example, the trig functions in Equation 5 have been given to 3 terms, while the exponential function has been given out to 4 terms.
This Program should perform at least the following functions: 1. The program should display a title banner which has the title of Taylor Series and some brief text that explains the functionality of the program. 2. The program should ask the user to enter the number of terms to use in the summations. 3. The program should perform adequate checks for limiting what numbers the user can input. 4. The program should display the output of each built-in function and the output from the calculated Taylor series. 5. The program should display the difference from the two prior listed results. 6. The program should be tested with user inputs of at least (2, 5, 10 and 30) terms 7. Three functions are required to be written for this problem. (a) Taylor Series calculation of the Sin(x) (b) Taylor Series calculation of the cos(x) (c) Taylor Series calculation of the ex (d) Note that the Factorial Operator is already a built in function.
##### 1 CommentShowHide None
James Tursa on 21 Apr 2015
You need to make an effort and post your code. Then we can comment on it and offer suggestions.