Solve and provide MATLAB code. (b) Write a function, MyCenteredDifference, that takes in a function f, a
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(b) Write a function, MyCenteredDifference, that takes in a function f, a point (or points) x, and a step size h that represents the spacing between the x points. The function should return an approximated derivative of f using centered differences at each x point. Using your function, approximate the derivative Dh f' using step sizes h = for n = 1,2, 3, ..., 15 on the interval [1, 2]. Compare the results of your function to the true derivatives f'(x) = 3x² + cos(x) by computing the error 2n En = max |f'(x) - Dh(x)| X Print your results in and the error ratio a table that has as columns: n, the error En(x), En (x) En-1(a) where E₁ (x) Eo (x) 1. = (b) Write a function, MyCenteredDifference, that takes in a function f, a point (or points) x, and a step size h that represents the spacing between the x points. The function should return an approximated derivative of f using centered differences at each x point. Using your function, approximate the derivative Dh f' using step sizes h = for n = 1,2, 3, ..., 15 on the interval [1, 2]. Compare the results of your function to the true derivatives f'(x) = 3x² + cos(x) by computing the error 2n En = max |f'(x) - Dh(x)| X Print your results in and the error ratio a table that has as columns: n, the error En(x), En (x) En-1(a) where E₁ (x) Eo (x) 1. =
Expert Answer:
Answer rating: 100% (QA)
Define the function fx and its true derivative fx fX 3x2cosx trueder... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these databases questions
-
fin510: Considering all else remains constant, if a firm is using a restricted policy of financing assets, it will have a level of assets, a assets turnover ratio, and consequently, a return on equity
-
A manufacturer built a new head office building and pald the following amounts: land ($100,000), building ($150,000]. Parking lot ($20,000) and landscaping ($8,000). What would be the maximum tax...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Let f: RR be a differentiable function such that its derivative f' is continuous and f(n) = 6. If F: [0, 1 by F(x) = f(t)dt, , and if ] R is defined (f'(x)+F(x)) cosx dx = 2 0 then the value of f(0)...
-
Are the following statements true or false? (a) In simple linear regression, the choice of which variable should be designated as the dependent variable and which variable should be designated as the...
-
The United States can produce X more efficiently than can Great Britain. Yet we import X from Great Britain. Explain.
-
Renewable Co. uses leasing as a secondary means of selling its products. The company contracted with Green Corporation to lease a machine with an economic life of 12 years to be used by Green...
-
Last year (2013), Simmons Company installed new factory equipment. The owner of the company, Gene Simmons, recently returned from an industry equipment exhibition where he watched computerized...
-
P2.5 (LO 1, 2, 3, 4), AP The Starr Theater, owned by Meg Vargo, will begin operations in March. The Starr will be unique in that it will show only triple features of sequential theme movies. As of...
-
Cost of completed job: Direct materials $15,500 Direct labor 21,000 Manufacturing overhead 16,800 Total cost $53,300 Unit cost ($53,300 2,000) $26.65 (a) On the basis of this data, answer the...
-
Use the following facts to calculate normalized values for P(B|A) and P(B|A): P(A) = 0.0025 P(B) = 0.015 P(A|B) = 0.6 P(A|B) = 0.25
-
What is the System Operations, Maintenance, and Support (OM&S) Phase, when does it start, and when does it end?
-
Demonstrate the relationship between project worth and cash flow.
-
What is the System Retirement and Disposal Phase, when does it start, and when does it end?
-
Describe the concept of cash flow.
-
Stereotyping is when you take something that it true in most cases and apply it to all cases. Question 1 1 options: True False
-
Controls can be identified based on their function. The functions are preventive, detective, and corrective. A. True B. False
-
Use co-factor expansion to prove that the determinant of an nn upper triangular matrix U is the product of the entries along its diagonal, n det U = Uij i=1
-
Consider the Lorenz equations with parameters = 10, b = 8/3, and r = 28. Employ initial conditions of x(0) = y(0) = z(0) = 5 and integrate from t = 0 to 20. Use the RungeKutta fourth-order method...
-
Consider the solution of the differential equation by an implicit Euler scheme. Determine the form of the residual and Jacobian that you would need to compute the values for time step i + 1. y"+yy +...
-
You are to enter the following items in the books, post to personal*accounts, and show transfers to the general ledger. 19X9 July 1 35 35 3 " 35 29 33 99 99 3 Credit purchases from: K Hill 380; M...
-
A On 31 December 19 X6, S Ltd had share capital of \( 400,000\) ordinary \( 1\) shares and reserves of \( 260,000\). Three years later the share capital is unchanged but the reserves have risen to \(...
-
You are to show the journal entries necessary to record the following items: (a) 19X8 May 1 Bought a motor vehicle on credit from Kingston Garage for 6,790. (b) 19X8 May 3 A debt of 34 owing from H...
Study smarter with the SolutionInn App