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?
-
What are the three alternative work arrangements of flextime, job sharing, and telecommuting? What are the advantages and disadvantages of each?
-
Mini Black Holes Cosmologists have speculated that black holes the size of a proton could have formed during the early days of the Big Bang when the universe began. If we take the diameter of a...
-
Boswell manufactures high-quality speakers. Suppose Boswell is considering spending the following amounts on a new quality program: Boswell expects this quality program to save costs as follows: It...
-
List two examples of audit evidence the auditor can use in support of each of the following: a. Recorded amount of entries in the acquisitions journal b. Physical existence of inventory c. Accuracy...
-
In the video below, critique the introduction and conclusion that was delivered in a speech on "Cyber Security." What are the speaker's weaknesses?
-
Aggressive versus Conservative seasonal funding strategy Dynabase Tool has forecast its total funds requirement for the coming year as shown in the following table. a. Divide the firm's monthly funds...
-
A vehicle is driving along a straight road. Its position function is given by s=f(t)=t^(2)-where s is measured in feet and t is measured in seconds. Use the definition of the derivative to find...
-
A comparison of one-sample, paired-samples, and independent-samples t-test s within the context of quantitative doctoral business research. In your comparison, do the following: Describe the research...
-
Mike works as a cashier at Miller's Hardware Store. His job description says Mike is authorized to operate the cash register to ring up sales, and to assist customers in selecting purchases. One day,...
-
Suppose a demand equation was estimated using the Regression technique. The explanatory variables included in the equation were price of own good, price of substitute good, income of consumers and...
-
Develop a presentation summarizing your analysis of the assigned Code provision and address the following questions: What ethical theories or principles is this provision designed to uphold? What...
-
A state law bans the use of used fabric to stuff mattresses. The state claims its objectives are public health (the used cloth could carry disease) and protection of consumers from deceit. Assume...
-
A rocket with mass mo is vertically launched from the earth's surface. The rocket's motor produces a constant force F. Attached to the ceiling of the cabin inside the rocket is a system with 2 masses...
-
Consider the combustion of methanol below. If 64 grams of methanol reacts with 160 grams of oxygen, what is the CHANGE in volume at STP. 2CH3OH(g) + 3O2(g) 2CO2(g) + 4H2O(1) The volume decreases by...
-
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.
-
Using the knowledge you gained from your interview in mini case 1 , design an interface for the individual you interviewed. What interface design modifications are you making so that the program will...
-
A portfolio on the capital market line with returns greater than the returns on the market portfolio represents a(n): A. Lending portfolio. B. Borrowing portfolio. C. Unachievable portfolio.
-
Highly risk-averse investors will most likely invest the majority of their wealth in: A. Risky assets. B. Risk-free assets. C. The optimal risky portfolio.
Study smarter with the SolutionInn App