# Finite element interpolation

I have a finite element solver that I implemented in MATLAB. I am calculating a specific potential function that is constant in each tetrahedral element. The question is, I want to be able to interpolate this potential on a rectangular grid on a slice. How can I achieve this? I can take the middle points of each element and then utilize a point-by-point interpolation. However, I also want to utilize the information that the potential is constant inside the element itself.

I want this interpolation to calculate the directional derivatives of the potential. It would be even better to be able to calculate directional derivatives of this potential. I cannot do these inside elements, obviously, since the potential is constant in each element. If you could suggest a method to calculate directional partial derivatives, it would be even better.

• I'm not quite clear about the details of the question because you don't distinguish between the original solution and the interpolant when you say "potential". Can you add formulas in which you give each of these names? Feb 15 at 14:53

In short, I interpolated the stress at each of the vertices, while still honoring the elemental average values. For each element e, approximate the value at each node a corresponding to that element using your basis functions $$\sigma_e = \sum_a N_a\sigma_a d\Gamma$$ Integrate over the element. $$\int_e\sigma_e d\Gamma = \int_e\ \sum_a N_a\sigma_a d\Gamma$$ Equivalently. $$\sigma_eV_e = \sum_a (\int_e N_a d\Gamma)\sigma_a$$ Therefore, you end up with an underdetermined system of e equations and v variables, where e is the number of elements and v is the number of vertices. An underdetermined system results in a least squares approximation that honors each of your equations. Technically, the nodes at the boundary are a linear extrapolation of that data, but the average quantities are still honored.