I have a matrix in which each element contains the coordinates of a 3D surface. Sometimes, some points will be "out of line" meaning that they will not conform to the general shape. For example you would have a slightly curved plane and all of a sudden a point with coordinates which are very different from the rest which produces a spike in the surface.
I was thinking of applying a smoothing filter or a lowpass filter.
Then I thought I might produce a distribution of the gradients of all points (w.r.t. the points around them) and only allow points with a gradient within two std. of the mean.
I'm really not sure what the best way would be (there might be others which I don't know about) so before I started implementing it into matlab I thought I'd ask.