Question: 1 ) Create a function to compute second derivative of a function using combination of Forward Finite Difference O ( h 2 ) , Backward

1) Create a function to compute second derivative of a function using combination of Forward Finite Difference O(h2),Backward Finite Difference O(h2) and Centered Finite Difference O(h2) formulations as follows:
function [ydd,newx,newy]= myGradient2(y,x)
% This function computes second derivative numerically
% Input:
%=====
% y = vector of dependent variable function values
% x = vector of independent variable values
% Output:
%=======
% ydd = numerical 2nd derivative
% newx = interpolated x values (if needed)
% new = interpolated y values (if needed)
(a) x and y must be equal size column vectors with at least 4 data points in each
(b) Function determines the minimum difference (\Delta x) from the input x vector
(c) Function uses interp1() to generate uniformly spaced x and y vectors with h =\Delta x
(d) Function uses forward difference ((2
)) for the first data point, backward difference ((2
)) for the last data
points, and centered difference ((2
)) for the interior points.

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 Finance Questions!