Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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

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

More Books

Students also viewed these Accounting questions

Question

Prepare a bank reconciliation. AppendixLO1

Answered: 1 week ago