|
"murthy m" <mmurthy007@googlemail.com> wrote in message
<fo6omv$ruq$1@fred.mathworks.com>...
> Hi
> I am using Matlab function 'griddata' to form a surface,
> is it possible to know the equation of this surface?
No. There is no single "equation". Depending
on the method chosen for the interpolation,
griddata uses a variety of local models to
interpolate with. But none of them provide
any simple equation that you can use.
Just like the spline interpolants found in
interp1, interp2, and interpn, the result is
built up in general from tiny little pieces of
functions. The same can be said for my own
gridfit, in case you hope for something there
along these lines.
> or is it possible to fit a predefined surface equation of
> the form z=f(x,y) for the 3D data by any other method?
Yes, you can do this, with a big caveat.
You need to choose your own model, in
advance. Just as in any linear or nonlinear
regression in 1-d, you need to choose a
logical model for your fit.
One simple alternative is the family of
polynomial models. Because they are so
simple to use and fit, many people use
them. In fact, you can find my own code,
polyfitn, on the file exchange. It can fit a
polynomial model for data in 1, 2, or a
higher number of dimensions. You still
need to choose the terms in the model
though.
Sadly, polynomial models can have some
serious flaws, despite the fact that Taylor
series have been around for a gazillion
years. In fact, I'd rarely recommend
polynomial models. Its almost that they
are too easy to use. The user tends to
use higher order models, thinking that a
lower residual error means a better fit.
Radial basis function models, thin plate
splines, etc., are other options. But they
too don't provide any simple models to
write down. No panacea there either.
In the end, you are best served if you
really need a simple equationl that you
can write down, by knowing your data.
Know where it comes from, know what
it means. Derive a model for that data
from physical principles. Then use a tool
to estimate the parameters of that model.
Unfortunately, this can take some effort.
But nothing worth doing is worth doing
poorly.
Since I can talk about this subject for
hours, I'll stop here.
John
|