Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 3: Convergence criteria In general, you won't know from the beginning how many terms you should use. Instead, you need to use a convergence

image text in transcribed
Part 3: Convergence criteria In general, you won't know from the beginning how many terms you should use. Instead, you need to use a convergence criterion. Write a function CosApproxConverge with first line: function cosx = CosApproxConverge (x, eps Thresh) This function should compute the value of cosx (the approximation of cos(x)) like CosApproxNterms. However, it should adjust the number of terms to give a desired accuracy. At each step, the code should estimate the error in the approximation by calculating: cosxola - cosxnewl cosxolal Where the old values are from the previous iteration and the new values are from the current iteration. (To be clear, you are NOT checking against the value of cos(x) that MATLAB generates (like in part 2), you are seeing whether the value from one iteration to the next is changing significantly.) This function should continue adding terms to improve the estimate until the error e falls below the threshold value eps Thresh, which is passed into the function. Again, create a script called CosApproxConverge_test to explore your function. Answer the following questions in comments in this script: a. Set x = 4t and eps Thresh to 0.001. Calculate cosx using CosApproxConverge. What is the difference between cosx and the true value of cos(x) (using built-in function)? Should this difference be the same as eps Thresh? Do you expect it to always be larger or smaller than epsThresh or to not have a general trend

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: 3

blur-text-image

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago