Find equation of a plane based on array

Hi,

I have an array of data that is basically a plane placed at an angle, see attached image. I would like to find a plane or surface that fits this and subtract it out so that the features on the surface don’t have a slant to them.

Thanks

You can use LinearModelFit:

data = Flatten[Table[{x, y, x + Sin[x + y]}, {x, 5}, {y, 5}], 1];
lmf[x_, y_] = Normal@LinearModelFit[data, {x, y}, {x, y}];
Plot3D[x + Sin[x + y] - lmf[x, y], {x, 0, 5}, {y, 0, 5}]

Thanks! That worked.