# Smoothness of a surface

I am currently working on a model which takes two parameters and produces a measurement statistic. Think of it as Z = f(X,Y).

Z is a matrix of my statistics and I am creating a surface plot of it in matlab. Basically, I am looking for a mathematical/analytical way of determining if the surface is smooth, or if it is jagged. Do large values tend to be clustered together or are they dispersed throughout the matrix? - that is my question. Basically, how mixed up are the values of my matrix?

I need to run the model over different parameter sets and I want to be able to analytically determine which one of my surfaces is the smoothest, has the greatest clustering of large values, and ideally, has no negative values.

Any help will be greatly appreciated and please let me know if you need any further information.

Cheers

One model for this situation is to view $Z$ as a realization of a stationary 2D stochastic process. The limiting behavior at zero (distance) of its empirical variogram or correlogram provides information about its smoothness: if the limiting correlation is less than one, the process is not even (mean square) continuous. Otherwise (Theorem)
A stationary stochastic process with correlation function $\rho(u)$ is $k$ times mean-square differentiable if and only if $\rho(u)$ is $2k$ times differentiable at $u=0$
Procedures variofit, likfit, and eyefit in the geoR package for R provide ways to estimate and visualize the variogram. None of these procedures require that you have all positive values, but they tend to work best when the values are not terrifically skewed. You must also remove any secular trend initially present in the surface; robust regression of $Z$ against $X$ and $Y$ is one way to do that and other ways (that simultaneously estimate the trend and the variogram of the residuals) are available in geoR.