Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: determining the equation of a 3-D surface
Date: Fri, 21 Nov 2008 22:06:03 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 47
Message-ID: <gg7bcb$asf$1@fred.mathworks.com>
References: <gg6ovh$4db$1@fred.mathworks.com> <gg6s8i$4mr$1@fred.mathworks.com> <gg71op$4c1$1@fred.mathworks.com> <gg7322$p7o$1@fred.mathworks.com> <gg73kq$53o$1@fred.mathworks.com> <gg7679$i6v$1@fred.mathworks.com> <gg7777$52l$1@fred.mathworks.com> <gg78ej$pbp$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227305163 11151 172.30.248.37 (21 Nov 2008 22:06:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 21 Nov 2008 22:06:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:502419


"loic paccard" <loic.paccard@ecam.fr> wrote in message <gg78ej$pbp$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote in message <gg7777$52l$1@fred.mathworks.com>...
> > "loic paccard" <loic.paccard@ecam.fr> wrote in message <gg7679$i6v$1@fred.mathworks.com>...
> > > "Johan Carlson" <Johan.E.Carlson@gmail.com> wrote in message <gg73kq$53o$1@fred.mathworks.com>...
> > > 
> > You actually want to find a minimum point on the
> > surface?
> > 
> > Just use interp2, with one of the smooth interpolants,
> > not the default interpolation method which is bilinear.
> > Thus, use either 'cubic' or 'spline' as the method.
> > 
> > Then, use an optimizer, applied to the prediction
> > interpolated by interp2. The starting value you would
> > use is just the location of the minimum value at any
> > of the nodes in the lattice. You might want to apply
> > bounds to the optimizer, to keep it within the range
> > of the data points, so fmincon is an option, but also
> > my fminsearchbnd from the file exchange. You do
> > not need anything complicated for the optimization.
> > 
> > http://www.mathworks.com/matlabcentral/fileexchange/8277
> > 
> > John
> 
> I just to minimize you are right.
> Either fmincon or fminsearchbnd would be a way.
> Ok but how can I write my objective function fun??
> I have only predicted values from real data and interpolations.
> 
> x = fminsearch(fun,x0,options)

I'll assume that z is a 13x13 array of points.

[x,y] = meshgrid(-36:6:36);
fun = @(xy) interp2(x,y,z,xy(1),xy(2),'spline');
[junk,ind] = min(z(:));
xystart = [x(ind),y(ind)];

Now just optimize fun. You might want to use a
bounded optimizer, either fmincon or fminsearchbnd
to keep you inside [-36,36]X[-36,36]. Something
like this:

xy = fminsearchbnd(fun,xystart,[-36 -36],[36 36]);

John