Question: The aim of this exercise is to create a function that estimates the second derivative of a discretely sampled function. Finite-difference expressions for the second

 The aim of this exercise is to create a function thatestimates the second derivative of a discretely sampled function. Finite-difference expressions forthe second derivatives are u (2.la) 2u1 502 + 4u3 44 h2

The aim of this exercise is to create a function that estimates the second derivative of a discretely sampled function. Finite-difference expressions for the second derivatives are u (2.la) 2u1 502 + 4u3 44 h2 Uj+1 2u; +uj-1 j=2,3,...,n - 1, h2 2un - 5un-1 + 4un-2 Un-3 h2 (2.1b) (2.1c) n where u; = u(x;) for j =1,2,..., n, u, zu"(x;) and r; are equispaced grid points with spacing h = x;+1 - Ij. Each of these formulae is second-order accurate, that is, the error is O(h) as h0. 2.1. Use Taylor's (Lagrange remainder) theorem to show that the error for (2.1b) is O(h) as h0. 2.2. Write a fully vectorised MATLAB function that uses (2.1) to estimate the second derivative of a vector of discrete data u. The function must have the interface function uxx = d2dx2u, h) where u is a row or column vector of data values u; = u(Lj), uxx is a vector of the same size as u containing the derivatives u, and h is the grid spacing. You may assume that the number of points in the vector u is n > 4. Use (2.la) or (2.1c) at the boundaries (j = 1 and n) and (2.1b) at all other interior points. Include d2dx2 in your report. Submit d2dx2 to MATLAB Grader by opening Assignment 2 - d2dx2 on MyUni. 2.3. Similarly to Question 1.2, write a script called d2dx2Error.m that uses d2dx2 to estimate the second derivative of u(x) = cos z for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!