<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835</link>
    <title>MATLAB Central Newsreader - Is it possible to optimize a spline function?</title>
    <description>Feed for thread: Is it possible to optimize a spline function?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by 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>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 01 Oct 2008 00:29:02 -0400</pubDate>
      <title>Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603115</link>
      <author>Hailey Yang</author>
      <description>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? &lt;br&gt;
&lt;br&gt;
Thank you very much for your help!&lt;br&gt;
&lt;br&gt;
Hailey </description>
    </item>
    <item>
      <pubDate>Wed, 01 Oct 2008 10:40:04 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603155</link>
      <author>John D'Errico</author>
      <description>&quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &amp;lt;gbug8e$2ae$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; 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? &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Why not? Try it!&lt;br&gt;
&lt;br&gt;
x = sort(randn(20,1));&lt;br&gt;
y = -cos(x);&lt;br&gt;
&lt;br&gt;
Obviously, a local minimum will occur at x = 0.&lt;br&gt;
&lt;br&gt;
Can an optimizer find that point, off of an&lt;br&gt;
interpolated spline? Remember that the spline&lt;br&gt;
is actually only an approximation to the true&lt;br&gt;
curve, so it might not always be perfect.&lt;br&gt;
&lt;br&gt;
spl = csapi(x,y);&lt;br&gt;
fun = @(X) fnval(spl,X);&lt;br&gt;
&lt;br&gt;
LB = min(x);&lt;br&gt;
UB = max(x);&lt;br&gt;
Xstart = 0.5;&lt;br&gt;
opts = optimset('Largescale','off','Display','off');&lt;br&gt;
Xmin = fmincon(fun,Xstart,[],[],[],[],LB,UB,[],opts)&lt;br&gt;
&lt;br&gt;
Xmin =&lt;br&gt;
&amp;nbsp;&amp;nbsp;-5.1909e-06&lt;br&gt;
&lt;br&gt;
HTH,&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Wed, 01 Oct 2008 19:13:36 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603255</link>
      <author>Stuart Kozola</author>
      <description>fmincon will get you a local minima.  If your surface is highly nonlinear &lt;br&gt;
(has many local minima, or no true global minima) you need to take that into &lt;br&gt;
account when you run the optimizer.  Your choice of starting point can be &lt;br&gt;
important in getting you to the global minima if there is one.  You might &lt;br&gt;
want to run fmincon with multiple start points to ensure that you find the &lt;br&gt;
true global and don't get stuck in a local minima.  You could also try &lt;br&gt;
Genetic Algorithm or Simulated Annealing which are better at getting out of &lt;br&gt;
local minima.&lt;br&gt;
&lt;br&gt;
&quot;John D'Errico&quot; &amp;lt;woodchips@rochester.rr.com&amp;gt; wrote in message &lt;br&gt;
news:gbvk24$a2m$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;gbug8e$2ae$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; As an example, if I use function csapi to approximate the space which are &lt;br&gt;
&amp;gt;&amp;gt; defined by some sample points and I let cs=csapi(...), then after I get &lt;br&gt;
&amp;gt;&amp;gt; this, is it possible to use some of the optimization functions, such as &lt;br&gt;
&amp;gt;&amp;gt; fmincon, to optimize this function and get the optimum? Or, if not using &lt;br&gt;
&amp;gt;&amp;gt; those optimization functions, are there other ways to optimize the spline &lt;br&gt;
&amp;gt;&amp;gt; function cs?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Why not? Try it!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; x = sort(randn(20,1));&lt;br&gt;
&amp;gt; y = -cos(x);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Obviously, a local minimum will occur at x = 0.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Can an optimizer find that point, off of an&lt;br&gt;
&amp;gt; interpolated spline? Remember that the spline&lt;br&gt;
&amp;gt; is actually only an approximation to the true&lt;br&gt;
&amp;gt; curve, so it might not always be perfect.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; spl = csapi(x,y);&lt;br&gt;
&amp;gt; fun = @(X) fnval(spl,X);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; LB = min(x);&lt;br&gt;
&amp;gt; UB = max(x);&lt;br&gt;
&amp;gt; Xstart = 0.5;&lt;br&gt;
&amp;gt; opts = optimset('Largescale','off','Display','off');&lt;br&gt;
&amp;gt; Xmin = fmincon(fun,Xstart,[],[],[],[],LB,UB,[],opts)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Xmin =&lt;br&gt;
&amp;gt;  -5.1909e-06&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; HTH,&lt;br&gt;
&amp;gt; John&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Fri, 03 Oct 2008 21:57:01 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603645</link>
      <author>Hailey Yang</author>
      <description>Thank you for your reply. My understanding for the spline approximation, which might be wrong, is that the whole region, if necessary, is seperated into different regions and each region is represented by a polynomial function. In that case, will there be any problem with optimizing each region and then comparing the optimums to get the global optimum? I guess there is a question sort of embeded in this question, which is whether the polynomial function is always convex at the positive variable region (since variables are positive in my problem). &lt;br&gt;
&lt;br&gt;
Another seperate question is that: is it possible to do so for multivariate spline approximation? &lt;br&gt;
&lt;br&gt;
Thank you very much!&lt;br&gt;
Hailey&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Stuart Kozola&quot; &amp;lt;skozola@mathworks.com&amp;gt; wrote in message &amp;lt;gc0i54$5c6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; fmincon will get you a local minima.  If your surface is highly nonlinear &lt;br&gt;
&amp;gt; (has many local minima, or no true global minima) you need to take that into &lt;br&gt;
&amp;gt; account when you run the optimizer.  Your choice of starting point can be &lt;br&gt;
&amp;gt; important in getting you to the global minima if there is one.  You might &lt;br&gt;
&amp;gt; want to run fmincon with multiple start points to ensure that you find the &lt;br&gt;
&amp;gt; true global and don't get stuck in a local minima.  You could also try &lt;br&gt;
&amp;gt; Genetic Algorithm or Simulated Annealing which are better at getting out of &lt;br&gt;
&amp;gt; local minima.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;John D'Errico&quot; &amp;lt;woodchips@rochester.rr.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; news:gbvk24$a2m$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;gbug8e$2ae$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; As an example, if I use function csapi to approximate the space which are &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; defined by some sample points and I let cs=csapi(...), then after I get &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; this, is it possible to use some of the optimization functions, such as &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; fmincon, to optimize this function and get the optimum? Or, if not using &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; those optimization functions, are there other ways to optimize the spline &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; function cs?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Why not? Try it!&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; x = sort(randn(20,1));&lt;br&gt;
&amp;gt; &amp;gt; y = -cos(x);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Obviously, a local minimum will occur at x = 0.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Can an optimizer find that point, off of an&lt;br&gt;
&amp;gt; &amp;gt; interpolated spline? Remember that the spline&lt;br&gt;
&amp;gt; &amp;gt; is actually only an approximation to the true&lt;br&gt;
&amp;gt; &amp;gt; curve, so it might not always be perfect.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; spl = csapi(x,y);&lt;br&gt;
&amp;gt; &amp;gt; fun = @(X) fnval(spl,X);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; LB = min(x);&lt;br&gt;
&amp;gt; &amp;gt; UB = max(x);&lt;br&gt;
&amp;gt; &amp;gt; Xstart = 0.5;&lt;br&gt;
&amp;gt; &amp;gt; opts = optimset('Largescale','off','Display','off');&lt;br&gt;
&amp;gt; &amp;gt; Xmin = fmincon(fun,Xstart,[],[],[],[],LB,UB,[],opts)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Xmin =&lt;br&gt;
&amp;gt; &amp;gt;  -5.1909e-06&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; HTH,&lt;br&gt;
&amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Fri, 03 Oct 2008 22:48:02 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603649</link>
      <author>John D'Errico</author>
      <description>&quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &amp;lt;gc64fd$i3k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Thank you for your reply. My understanding for the spline approximation, which might be wrong, is that the whole region, if necessary, is seperated into different regions and each region is represented by a polynomial function.&lt;br&gt;
&lt;br&gt;
Yes. A spline is a piecewise polynomial model,&lt;br&gt;
that approximates your function from your&lt;br&gt;
data points. The knots or break points specify&lt;br&gt;
the locations where the pieces are tied together.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; In that case, will there be any problem with optimizing each region and then comparing the optimums to get the global optimum?&lt;br&gt;
&lt;br&gt;
Why should there be a problem?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; I guess there is a question sort of embeded in this question, which is whether the polynomial function is always convex at the positive variable region (since variables are positive in my problem). &lt;br&gt;
&lt;br&gt;
There is no such constraint on a spline such&lt;br&gt;
that it satisfies any convexity constraints, at&lt;br&gt;
least unless you have constructed the spline&lt;br&gt;
such that this is true.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; Another seperate question is that: is it possible to do so for multivariate spline approximation? &lt;br&gt;
&lt;br&gt;
Yes.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Sat, 04 Oct 2008 23:55:03 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603737</link>
      <author>Vincent Morio</author>
      <description>&quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &amp;lt;gbug8e$2ae$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; 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? &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you very much for your help!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hailey &lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
&lt;br&gt;
I think that you can find some answers by looking at the work conducted by Richard Murray at Caltech university for real-time trajectory optimization by flatness approach. B-splines are used to parameterized the optimization variables (flat outputs), and the B-splines control points are then optimized by an efficient NLP solver (NPSOL by Stanford laboratory), better than fmincon!&lt;br&gt;
&lt;br&gt;
Cheers,&lt;br&gt;
&lt;br&gt;
V. Morio&lt;br&gt;
PhD student in Automatic Control&lt;br&gt;
IMS lab./University of Bordeaux, France</description>
    </item>
    <item>
      <pubDate>Mon, 06 Oct 2008 21:17:03 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603992</link>
      <author>Hailey Yang</author>
      <description>Thanks again for your reply. As for the multivariate spline approximation, I looked into the help file for spline toolbox by searching &quot;multivariate spline&quot;, but didn't find much helpful information on what command I am supposed to do it. &lt;br&gt;
&lt;br&gt;
I tried to use csapi, but it doesn't work once my variables x becomes a matrix, which seems suggesting that it only works for univariate approximation.&lt;br&gt;
&lt;br&gt;
In the help file, the only relevant command to do multivariate spline is &quot;stform&quot;, but I don't quite understand how this works even after I read the help file. Also it is said in the help file that: &quot;At present, the toolbox works with just one kind of stform, namely a bivariate thin-plate spline and its first partial derivatives. &quot;. Does this mean that it won't work if my function is determined by more than two variables?  &lt;br&gt;
&lt;br&gt;
Will there be other functions/commands that can do multivariate spline approximation that I missed? &lt;br&gt;
&lt;br&gt;
Hailey  &lt;br&gt;
&lt;br&gt;
&quot;John D'Errico&quot; &amp;lt;woodchips@rochester.rr.com&amp;gt; wrote in message &amp;lt;gc67f2$pnu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &amp;lt;gc64fd$i3k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Thank you for your reply. My understanding for the spline approximation, which might be wrong, is that the whole region, if necessary, is seperated into different regions and each region is represented by a polynomial function.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Yes. A spline is a piecewise polynomial model,&lt;br&gt;
&amp;gt; that approximates your function from your&lt;br&gt;
&amp;gt; data points. The knots or break points specify&lt;br&gt;
&amp;gt; the locations where the pieces are tied together.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; In that case, will there be any problem with optimizing each region and then comparing the optimums to get the global optimum?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why should there be a problem?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I guess there is a question sort of embeded in this question, which is whether the polynomial function is always convex at the positive variable region (since variables are positive in my problem). &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; There is no such constraint on a spline such&lt;br&gt;
&amp;gt; that it satisfies any convexity constraints, at&lt;br&gt;
&amp;gt; least unless you have constructed the spline&lt;br&gt;
&amp;gt; such that this is true.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; Another seperate question is that: is it possible to do so for multivariate spline approximation? &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Yes.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; John</description>
    </item>
    <item>
      <pubDate>Mon, 06 Oct 2008 21:25:03 -0400</pubDate>
      <title>Re: Is it possible to optimize a spline function?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236835#603994</link>
      <author>Hailey Yang</author>
      <description>Hi, Vincent&lt;br&gt;
&lt;br&gt;
Thank you for the information. Can I ask if the solver that they developed is publicly available? &lt;br&gt;
&lt;br&gt;
Hailey&lt;br&gt;
&lt;br&gt;
&quot;Vincent Morio&quot; &amp;lt;vincent.morio@mathworks.com&amp;gt; wrote in message &amp;lt;gc8von$irn$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Hailey Yang&quot; &amp;lt;haileyyang@hotmail.com&amp;gt; wrote in message &amp;lt;gbug8e$2ae$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; 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? &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you very much for your help!&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hailey &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I think that you can find some answers by looking at the work conducted by Richard Murray at Caltech university for real-time trajectory optimization by flatness approach. B-splines are used to parameterized the optimization variables (flat outputs), and the B-splines control points are then optimized by an efficient NLP solver (NPSOL by Stanford laboratory), better than fmincon!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Cheers,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; V. Morio&lt;br&gt;
&amp;gt; PhD student in Automatic Control&lt;br&gt;
&amp;gt; IMS lab./University of Bordeaux, France</description>
    </item>
  </channel>
</rss>

