Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me solve the following problem using Matlab Language ? Here are some hints and tips. Problem 1: Numerical Differentiation % Basic idea:
Can someone help me solve the following problem using Matlab Language? Here are some hints and tips.
Problem 1: Numerical Differentiation % Basic idea: Take a point to the right and a point to the left and average % their slopes. % One-sided estimates: Leftmost point and rightmost point. % Equation (2) is for the rightmost edge. % Equation (3) is for the leftmost edge. % These are "higher order" methods as they are more accurate than linear, quadratic, trapezoidal, simpson's % Error if you have
Homework Problem 1: Numerical Differentiation In this problem, you will compute numerical derivatives of functions using "higher-order" techniques as compared to what we saw in lecture. For points in x separated by a distance of h, a centered estimate for the first derivative is given by: r +h)- f(x -h 2h One-sided estimates can be computed by 2h h) - f(x 2h 2h Note that you need two points to compute a centered derivative and three points to compute a one-sided derivative Create a function MyDer which takes as inputs h (the x-spacing) and y (an array of data) and returns the first order derivative yp of y using Equation (1), Equation (2) and Equation (3). Your code must return an error if you have less than three data points as you cannot evaluate a one-sided derivative otherwise. You can use the following test case to check your code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started