I have a set of data, $x, y$ and $ z$, each with length n:
$x \rightarrow \{x_{1}...x_{n}\}$
$y \rightarrow \{y_{1}...y_{n}\}$
$z \rightarrow \{z_{1}...z_{n}\}$
$y$ and $z$ are parameterised by $x$:
$y = y(x)$
$z = z(x)$
Problem 1
I wish to find derivatives $\Large \frac{dy}{dx}$ and $\Large \frac{dz}{dx}$.
The 'second-order error' numerical scheme: $\Large \frac{dy}{dx} = \frac{y(x+dx)-y(x-dx)}{2dx} + \mathcal{O}({dx}^{2})$
woud usually work, but in my case, my 'x' data is not uniformly spaced (it is nonlinear) i.e. '$dx$' is not constant (hence my problem turns into a first order error one). The problem applies for the derivative of z.
Can anyone suggest a good method to find these derivatives? (for anyone interested in meteorology, $x$ are pressure coordinates in atmosphere, $y$ is the potential temperature, $z$ is the geopotential height).
One person suggested that I interpolate $x$, $y$ and $z$ onto a new $x$ whereby this new list of $x$ values are uniformly spaced. However, I also want to see how the error introduced here propagates to the end result.
Problem 2
I wish to find the derivative: $\Large \frac{dy}{dz}$. However, as my $z$ are not necessarily spaced evenly between each other, my numerical scheme is not second order. Hence, what scheme should I use and what is my resulting error, preferably as a function of $x$. I guess it's a similar problem to above.