Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+best one for a company whose strategic goal is

Answered: 1 week ago

Question

Describe ERP and how it can create efficiency within a business

Answered: 1 week ago