Question: Problem 2 : Understanding of Errors ( using an example of the cosine series ) The algorithm for the cosine Taylor's series expansion is given

Problem 2: Understanding of Errors (using an example of the cosine series)
The algorithm for the cosine Taylor's series expansion is given as follows:
cos(x)=1-x22!+x44!-x66!+cdots=k=1(-1)k+1x(2k-2)(2k-2)!
a) Create a user defined function to approximate the value of cosine (the algorithm above) using a while-loop to ensure that the algorithm runs until the relative error is below a given error tolerance (maxtol). A partially completed code has been provided (remove the "part" from the function handle before running).
b) Test the function created in part (a) by evaluating at x=5 and maxtol =1e-3.
c) Modify (slightly) the MATLAB function cosine_taylorN so that the while-loop checks both the error tolerance and the maximum number of iterations (maxitr). In other words, the loop terminates when either the error is sufficiently small, or the maximum number of iterations is exceeded. The required inputs and outputs for the fulction are given below:
function [y,N]= cosine_taylor , maxtol, maxitr
 Problem 2: Understanding of Errors (using an example of the cosine

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!