Recall that the following Taylor series is used to approximate Cosine: (-1)x2n cos(x) = (2n)! n=0...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Recall that the following Taylor series is used to approximate Cosine: (-1)"x2n cos(x) = (2n)! n=0 You have been tasked with developing an M-file that allows other engineers to quickly determine the minimum n needed to reduce the truncation error below an error threshold. The truncation error is the absolute error between the approximation and MATLAB's cos() function. Note: You may want to Google the Taylor series to gain a better understanding of it. Your code should do the following: 1. Ask the user to enter an error threshold value (it should work with vectors) 2. Find the number of terms (minimum n) needed so that the truncation error is below the user error threshold for x = -2n to 2n. 3. Print the minimum n value, the mean truncation error and the maximum truncation error using fprintf. 4. Plot the truncation error against x. Test your code with the following error thresholds: 0.1, 0.01, le-10. The answers for the thresholds above should be n=8, 9, 16, respectively. This is a reference to see whether your code is working correctly. Hint: Your code may include both while and for loops and/or a created function to calculate the approximation of Cosine. Recall that the following Taylor series is used to approximate Cosine: (-1)"x2n cos(x) = (2n)! n=0 You have been tasked with developing an M-file that allows other engineers to quickly determine the minimum n needed to reduce the truncation error below an error threshold. The truncation error is the absolute error between the approximation and MATLAB's cos() function. Note: You may want to Google the Taylor series to gain a better understanding of it. Your code should do the following: 1. Ask the user to enter an error threshold value (it should work with vectors) 2. Find the number of terms (minimum n) needed so that the truncation error is below the user error threshold for x = -2n to 2n. 3. Print the minimum n value, the mean truncation error and the maximum truncation error using fprintf. 4. Plot the truncation error against x. Test your code with the following error thresholds: 0.1, 0.01, le-10. The answers for the thresholds above should be n=8, 9, 16, respectively. This is a reference to see whether your code is working correctly. Hint: Your code may include both while and for loops and/or a created function to calculate the approximation of Cosine.
Expert Answer:
Answer rating: 100% (QA)
Copyable code clear all clc read the threshold value ... View the full answer
Related Book For
Intermediate Accounting
ISBN: 978-0132162302
1st edition
Authors: Elizabeth A. Gordon, Jana S. Raedy, Alexander J. Sannella
Posted Date:
Students also viewed these programming questions
-
You have been tasked with understanding income tax reporting at Walmart Corporation and comparing it to Target. Use the following information from Walmart Corporation to address the questions. The...
-
You have been tasked with developing the software for an online Computer Science coach ing system . The idea of the system is to connect students and a coach in an interactive distance learning...
-
The formula s = 16t2 is used to approximate the distance s, in feet, that an object falls freely from rest in t seconds. Use this formula for Exercise. a. The Taipei 101 Tower, also known as the...
-
What are the premises for successful paleostress analysis?
-
Gatcheva, Inc. shows a cash balance of $ 24,000 on January 1, 2008. The expected sales (in units) of its product by month for the first quarter are January...
-
You have been named manager for a Mexican-themed restaurant at a vacation hot spot in the Dominican Republic. Your highest volume season is typically from mid November to late March. How might you...
-
What item is the key figure (that is, 100 percent) in a common-size income statement? A commonsize balance sheet?
-
A circular pipe of 25-mm outside diameter is placed in an airstream at 25C and l-atm pressure. The air moves in cross flow over the pipe at 15 m/s, while the outer surface of the pipe is maintained...
-
Compute the benefit analysis assuming: 3 percent increase in pay. Reese will increase the 401(k) contribution to 8 percent with a company match of 50 percent up to a 3 percent contribution by the...
-
Erica and Bob participate in a friendly Hackathon that allows each to solve one question a day out of the three offered. There will be one easy, one medium and one hard question, with points awarded...
-
You work for a hospitality business that specialises in running quality outdoor functions and events. You promote yourself as an environmentally friendly service provider. What should you look for...
-
The following information is available from the inventory records of Neer Company for January: Units Unit Cost Total Cost Balance at January 1 3 , 0 0 0 $ 9 . 7 7 $ 2 9 , 3 1 0 Purchases: January 6 2...
-
Redeem is a nonprofit organization that assists children who are victims of abuse and women who are victims of domestic violence. Redeem services include emer- gency shelter, advocacy services,...
-
Preston Ceramics, a division of Monette Corporation, has an operating income of $63,000 and total assets of $360,000. The required rate of return for the company is 9%. The company is evaluating...
-
Given the following population data set: 69, 84, 52, 93, 61, 74, 79, 65, 88, 63, 57, 64, 67, 72, 74, 55, 82, 61, 68, 77 Find the mean, median, mode, and range Find the variance and the standard...
-
Bridge City Consulting bought a building and the land on which it is located for $100,000 cash. The land is estimated to represent 60 percent of the purchase price. The company paid $10,000 for...
-
5.4.36 Question Help The average math SAT score is 515 with a standard deviation of 116. A particular high school claims that its students have unusually high math SAT scores. A random sample of 60...
-
Anne is employed by Bradley Contracting Company. Bradley has a $1.3 million contract to build a small group of outbuildings in a national park. Anne alleges that Bradley Contracting has discriminated...
-
Wilson Incorporated acquired a leather- cutting machine for $ 200,000 on December 31, 2015. The general accountant incorrectly coded the invoice as Miscellaneous Expense. The general accountant...
-
Does the going- concern concept justify the use of the projected benefit obligation in all pension calculations? Explain.
-
Adam Levine invested $ 100,000 in a fund that earns 8% annual interest, compounded annually. How much will his investment be worth in five years? Draw a timeline to illustrate the problem.
-
Information systems auditors should be most concerned about management's decision to undertake outsourcing of the information systems function when: a. A long-term contract with the outsourcing...
-
Which of the following statements about the implications of privacy legislation for auditors most likely is false? a. As users of personal data, auditors will be exempt from privacy legislation...
-
Which of the following is not an implication of interorganizational information systems and virtual organizations for the conduct of audit work? a. Processing controls become more important than...
Study smarter with the SolutionInn App