Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is it possible to optimize a spline function?
Date: Wed, 1 Oct 2008 10:40:04 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 32
Message-ID: <gbvk24$a2m$1@fred.mathworks.com>
References: <gbug8e$2ae$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1222857604 10326 172.30.248.35 (1 Oct 2008 10:40:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Oct 2008 10:40:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:493073


"Hailey Yang" <haileyyang@hotmail.com> wrote in message <gbug8e$2ae$1@fred.mathworks.com>...
> As an example, if I use function csapi to approximate the space which are defined by some sample points and I let cs=csapi(...), then after I get this, is it possible to use some of the optimization functions, such as fmincon, to optimize this function and get the optimum? Or, if not using those optimization functions, are there other ways to optimize the spline function cs? 


Why not? Try it!

x = sort(randn(20,1));
y = -cos(x);

Obviously, a local minimum will occur at x = 0.

Can an optimizer find that point, off of an
interpolated spline? Remember that the spline
is actually only an approximation to the true
curve, so it might not always be perfect.

spl = csapi(x,y);
fun = @(X) fnval(spl,X);

LB = min(x);
UB = max(x);
Xstart = 0.5;
opts = optimset('Largescale','off','Display','off');
Xmin = fmincon(fun,Xstart,[],[],[],[],LB,UB,[],opts)

Xmin =
  -5.1909e-06

HTH,
John