Calculating derivative of any unknown function $f(x)$ at a fixed $x$ using finite difference method

280 Views Asked by At

Let's say I have a one variable function $f(x)$ and know its values at some given values of $x$ i.e. I have the following data

x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

f(x)=[a, b, c, d, e, f, g, h, i, j]

where $a,b,c\cdots$ are some numerical values. With this data given, I want to write a code (preferably in MATLAB) to calculate the 1st and 2nd derivative at $x=0$ using finite difference method.

I can not think that finite difference method can be applied on this problem. But my professor told me that it can be done. My question is how?