<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163107</link>
    <title>MATLAB Central Newsreader - griddata: can we get equation of surface?</title>
    <description>Feed for thread: griddata: can we get equation of surface?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2010 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 04 Feb 2008 10:17:03 -0500</pubDate>
      <title>griddata: can we get equation of surface?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163107#412781</link>
      <author>murthy m</author>
      <description>Hi&lt;br&gt;
&amp;nbsp;&amp;nbsp;I am using Matlab function 'griddata' to form a surface,&lt;br&gt;
is it possible to know the equation of this surface?&lt;br&gt;
or is it possible to fit a predefined surface equation of&lt;br&gt;
the form z=f(x,y) for the 3D data by any other method?&lt;br&gt;
&lt;br&gt;
Thanks in advance&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 04 Feb 2008 11:06:03 -0500</pubDate>
      <title>Re: griddata: can we get equation of surface?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163107#412788</link>
      <author>John D'Errico</author>
      <description>&quot;murthy m&quot; &amp;lt;mmurthy007@googlemail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fo6omv$ruq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi&lt;br&gt;
&amp;gt;   I am using Matlab function 'griddata' to form a surface,&lt;br&gt;
&amp;gt; is it possible to know the equation of this surface?&lt;br&gt;
&lt;br&gt;
No. There is no single &quot;equation&quot;. Depending&lt;br&gt;
on the method chosen for the interpolation,&lt;br&gt;
griddata uses a variety of local models to&lt;br&gt;
interpolate with. But none of them provide&lt;br&gt;
any simple equation that you can use.&lt;br&gt;
&lt;br&gt;
Just like the spline interpolants found in&lt;br&gt;
interp1, interp2, and interpn, the result is&lt;br&gt;
built up in general from tiny little pieces of&lt;br&gt;
functions. The same can be said for my own&lt;br&gt;
gridfit, in case you hope for something there&lt;br&gt;
along these lines.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; or is it possible to fit a predefined surface equation of&lt;br&gt;
&amp;gt; the form z=f(x,y) for the 3D data by any other method?&lt;br&gt;
&lt;br&gt;
Yes, you can do this, with a big caveat.&lt;br&gt;
&lt;br&gt;
You need to choose your own model, in&lt;br&gt;
advance. Just as in any linear or nonlinear &lt;br&gt;
regression in 1-d, you need to choose a&lt;br&gt;
logical model for your fit.&lt;br&gt;
&lt;br&gt;
One simple alternative is the family of&lt;br&gt;
polynomial models. Because they are so&lt;br&gt;
simple to use and fit, many people use&lt;br&gt;
them. In fact, you can find my own code,&lt;br&gt;
polyfitn, on the file exchange. It can fit a&lt;br&gt;
polynomial model for data in 1, 2, or a&lt;br&gt;
higher number of dimensions. You still&lt;br&gt;
need to choose the terms in the model&lt;br&gt;
though.&lt;br&gt;
&lt;br&gt;
Sadly, polynomial models can have some&lt;br&gt;
serious flaws, despite the fact that Taylor&lt;br&gt;
series have been around for a gazillion&lt;br&gt;
years. In fact, I'd rarely recommend&lt;br&gt;
polynomial models. Its almost that they&lt;br&gt;
are too easy to use. The user tends to&lt;br&gt;
use higher order models, thinking that a &lt;br&gt;
lower residual error means a better fit.&lt;br&gt;
&lt;br&gt;
Radial basis function models, thin plate&lt;br&gt;
splines, etc., are other options. But they&lt;br&gt;
too don't provide any simple models to&lt;br&gt;
write down. No panacea there either.&lt;br&gt;
&lt;br&gt;
In the end, you are best served if you&lt;br&gt;
really need a simple equationl that you&lt;br&gt;
can write down, by knowing your data.&lt;br&gt;
Know where it comes from, know what&lt;br&gt;
it means. Derive a model for that data&lt;br&gt;
from physical principles. Then use a tool&lt;br&gt;
to estimate the parameters of that model.&lt;br&gt;
Unfortunately, this can take some effort.&lt;br&gt;
But nothing worth doing is worth doing&lt;br&gt;
poorly.&lt;br&gt;
&lt;br&gt;
Since I can talk about this subject for&lt;br&gt;
hours, I'll stop here.&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 04 Feb 2008 11:53:02 -0500</pubDate>
      <title>Re: griddata: can we get equation of surface?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163107#412800</link>
      <author>murthy m</author>
      <description>&quot;John D'Errico&quot; &amp;lt;woodchips@rochester.rr.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;fo6rir$254$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
Thank you. Your 'gridfit' function is excellent. In my case,&lt;br&gt;
just to give you an idea of what I am trying, I have x,y and&lt;br&gt;
z matrices as given below and I want to choose an&lt;br&gt;
exponential function of the form&lt;br&gt;
Z(x,y)=exp[-(x-x(i))-(y-y(i))/m*m] where m is a constant to&lt;br&gt;
be obtained. Is it possible?&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; x=1:7;&lt;br&gt;
&amp;gt;&amp;gt; y=1:11;&lt;br&gt;
&amp;gt;&amp;gt; z=&lt;br&gt;
[0.3100    0.3393    0.3638    0.4013    0.3783    0.3485  &lt;br&gt;
&amp;nbsp;0.3258&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3450    0.3996    0.4548    0.5188    0.4564    0.4052&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3471&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3704    0.4487    0.5299    0.6182    0.5357    0.4555&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3769&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3997    0.5052    0.6176    0.7382    0.6186    0.5185&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4039&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4279    0.5614    0.7074    0.8544    0.7155    0.5784&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4389&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4602    0.6335    0.8104    1.0000    0.8238    0.6521&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4743&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4372    0.5812    0.7335    0.8823    0.7279    0.5845&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4327&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4001    0.5199    0.6393    0.7660    0.6502    0.5318&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.4108&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3769    0.4704    0.5695    0.6650    0.5740    0.4791&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3816&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3460    0.4139    0.4785    0.5481    0.4886    0.4199&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3559&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3197    0.3578    0.3943    0.4302    0.3958    0.3579&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3212];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 04 Feb 2008 13:06:04 -0500</pubDate>
      <title>Re: griddata: can we get equation of surface?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163107#412809</link>
      <author>John D'Errico</author>
      <description>&quot;murthy m&quot; &amp;lt;mmurthy007@googlemail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fo6uau$47e$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;John D'Errico&quot; &amp;lt;woodchips@rochester.rr.com&amp;gt; wrote in&lt;br&gt;
&amp;gt; message &amp;lt;fo6rir$254$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you. Your 'gridfit' function is excellent. In my case,&lt;br&gt;
&amp;gt; just to give you an idea of what I am trying, I have x,y and&lt;br&gt;
&amp;gt; z matrices as given below and I want to choose an&lt;br&gt;
&amp;gt; exponential function of the form&lt;br&gt;
&amp;gt; Z(x,y)=exp[-(x-x(i))-(y-y(i))/m*m] where m is a constant to&lt;br&gt;
&amp;gt; be obtained. Is it possible?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; x=1:7;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; y=1:11;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; z=&lt;br&gt;
&amp;gt; [0.3100    0.3393    0.3638    0.4013    0.3783    0.3485  &lt;br&gt;
&amp;gt;  0.3258&lt;br&gt;
&amp;gt;     0.3450    0.3996    0.4548    0.5188    0.4564    0.4052&lt;br&gt;
&amp;gt;    0.3471&lt;br&gt;
&amp;gt;     0.3704    0.4487    0.5299    0.6182    0.5357    0.4555&lt;br&gt;
&amp;gt;    0.3769&lt;br&gt;
&amp;gt;     0.3997    0.5052    0.6176    0.7382    0.6186    0.5185&lt;br&gt;
&amp;gt;    0.4039&lt;br&gt;
&amp;gt;     0.4279    0.5614    0.7074    0.8544    0.7155    0.5784&lt;br&gt;
&amp;gt;    0.4389&lt;br&gt;
&amp;gt;     0.4602    0.6335    0.8104    1.0000    0.8238    0.6521&lt;br&gt;
&amp;gt;    0.4743&lt;br&gt;
&amp;gt;     0.4372    0.5812    0.7335    0.8823    0.7279    0.5845&lt;br&gt;
&amp;gt;    0.4327&lt;br&gt;
&amp;gt;     0.4001    0.5199    0.6393    0.7660    0.6502    0.5318&lt;br&gt;
&amp;gt;    0.4108&lt;br&gt;
&amp;gt;     0.3769    0.4704    0.5695    0.6650    0.5740    0.4791&lt;br&gt;
&amp;gt;    0.3816&lt;br&gt;
&amp;gt;     0.3460    0.4139    0.4785    0.5481    0.4886    0.4199&lt;br&gt;
&amp;gt;    0.3559&lt;br&gt;
&amp;gt;     0.3197    0.3578    0.3943    0.4302    0.3958    0.3579&lt;br&gt;
&amp;gt;    0.3212];&lt;br&gt;
&lt;br&gt;
In theory, one could estimate the coefficients of&lt;br&gt;
your model from data such as this. There are&lt;br&gt;
several methods one might use, ranging from a&lt;br&gt;
nonlinear regression to a transformation to a linear&lt;br&gt;
regression problem. HOWEVER...&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Do you realize that your model does not even come&lt;br&gt;
REMOTELY close to having the correct shape for&lt;br&gt;
this surface? Have you properly written down the&lt;br&gt;
actual model that you will use?&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
