Consider the function f(x)=sin(x) . In matlab write a program, FiniteDiff.m, to calculate the finite-difference approximation to
Fantastic news! We've Found the answer you've been seeking!
Question:
Consider the function f(x)=sin(x). In matlab write a program, FiniteDiff.m, to calculate the finite-difference approximation to the derivative of f(x) at the point x=x0 from the expression:
df(x)/dx|x=x0 ≈(f(x0+∆x)-f(x0))/∆x
Run the program with smaller and smaller numbers for Dx to see that the approximation converges to a limit. Find the limit for various values of x0, including x0=0, pi/3, pi/4, pi/2, 7/8pi and 2pi.
Related Book For
Posted Date: