Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need your help Problem 4 (15 points) Develop a Matlab function mySecondDerivOr

ID: 3168185 • Letter: I

Question

I need your help

Problem 4 (15 points) Develop a Matlab function mySecondDerivOrder2 that calculates the second derivative of a function y(x) that is given by a set of discrete data points (zi, yi) at every one of the discrete data points with second order. Assume that the data points are spaced an equal distance apart. As input the function shall take the vectors x and y that contain the data points. As output the function shall give a vector ypp that contains the second derivative at all points xi.

Explanation / Answer

%%%% Matlab function %%%%

function ypp = mySecondDerivOrder2 ( x,y)
h=x(2)-x(1);
l=length(x);
for n=1:l-2
ypp(n)=(y(n+2)-2*y(n+1)+y(n))/h^2; %%% Forword diffrerence
end

end