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 lowestorder 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 values. Call
your function twoderivs which takes as inputs two vectors, the first is the coordinates of the data points and the second is the coordinates. You can assume the userinputted data has
and y vectors of the same length. Your function should give two outputs, yp which is and ypp which is Finally, plot all three on the same figure: make red, green, and 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
twoderivs
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
