Question: IN MATLAB PLEASE Create a function which takes as input a set of data points, and outputs the first and second numerical derivatives according to

IN MATLAB PLEASE
Create a function which takes as input a set of data points, and outputs the first and second numerical derivatives according to the following:
For the left endpoint, use the forward difference method.
For interior points, use the centered difference method.
For the right endpoint, use the backward difference method.
Use the lowest-order method in each case. (These are the formulas we derived in class via Taylor series.) You can assume that the input data has distinct and monotonically increasing x values. Call
your function two_derivs (x,y) which takes as inputs two vectors, the first is the x-coordinates of the data points and the second is the y-coordinates. You can assume the user-inputted data has x
and y vectors of the same length. Your function should give two outputs, yp which is y' and ypp which is y''. Finally, plot all three on the same figure: make y(x) red, y'(x) green, and y''(x) blue.
A template is given below.
Resets the solution code to the
starter code provided by the
instructor. Changes you have
made are discarded.
Function
Code to call your function (?)
1 two_derivs (x,y)
IN MATLAB PLEASE Create a function which takes as

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!