Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have three 3D matrices X, Y, and Z that define a matrix V of the same size over some region. The matrices are regularly spaced. I'm trying to compute the gradient of V. I have read that interpolating and computing derivatives with splines leads to better results than using central differences. For instance, I have worked before with splinefit and ppdiff ( The problem is that I can't find code to do this in 3D.

Assuming I only want the derivatives at the sampled locations define by the X, Y, and Z matrices, could I do 1D spline approximations for each dimension and compute the partial derivatives that way? I've tried it with a simple 2D Matlab example, and this idea works; however, I wanted to see if it made mathematical sense

Thanks for your help!

share|cite|improve this question

Yes, doing 1D spline calculations in each of the dimensions separately is a reasonable approach.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.