<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213</link>
    <title>MATLAB Central Newsreader - fitting data to an integral</title>
    <description>Feed for thread: fitting data to an integral</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>Sat, 10 Mar 2007 03:54:49 -0500</pubDate>
      <title>fitting data to an integral</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213#360467</link>
      <author>B.K. Chen</author>
      <description>Hi , all,&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I have a set of data points to be fitted to an equation,but this&lt;br&gt;
equatin contains an integral sign(it's&lt;br&gt;
not analytic). I cannot find any way to fit my data to an&lt;br&gt;
integral equation in Matlab. Does somebody have ideas about this&lt;br&gt;
issue? If yes,please let me know!</description>
    </item>
    <item>
      <pubDate>Sat, 10 Mar 2007 04:36:38 -0500</pubDate>
      <title>Re: fitting data to an integral</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213#360469</link>
      <author>John D'Errico</author>
      <description>B.K. Chen wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi , all,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have a set of data points to be fitted to an equation,but&lt;br&gt;
&amp;gt; this&lt;br&gt;
&amp;gt; equatin contains an integral sign(it's&lt;br&gt;
&amp;gt; not analytic). I cannot find any way to fit my data to an&lt;br&gt;
&amp;gt; integral equation in Matlab. Does somebody have ideas about this&lt;br&gt;
&amp;gt; issue? If yes,please let me know!&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&lt;br&gt;
A lot depends on the equation itself&lt;br&gt;
and what is under the integral. Many&lt;br&gt;
integrals exist as special functions.&lt;br&gt;
(erf, elliptic functions, incomplete&lt;br&gt;
beta function, etc.) Don't be put off&lt;br&gt;
by my response. MANY people post&lt;br&gt;
exactly this question when their&lt;br&gt;
integrand is as simple as exp(-x^2).&lt;br&gt;
They simply have not looked very hard&lt;br&gt;
for the answer.&lt;br&gt;
&lt;br&gt;
If their really is no solution available&lt;br&gt;
in the form of a special function, then&lt;br&gt;
quad is an option, called from within&lt;br&gt;
your objective function. Or splines&lt;br&gt;
(often coupled with regularization)&lt;br&gt;
can be used when no explicit form is&lt;br&gt;
known.&lt;br&gt;
&lt;br&gt;
So without any knowledge of your&lt;br&gt;
problem, I cannot suggest how to&lt;br&gt;
solve it.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Sat, 10 Mar 2007 05:04:12 -0500</pubDate>
      <title>Re: fitting data to an integral</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213#360470</link>
      <author>B.K. Chen</author>
      <description>Hi, John,&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;My equation is show below:&lt;br&gt;
&lt;br&gt;
integral sign { [G/(x^2+G^2)] * exp[-(G-a)^2/2b^2] } dG&lt;br&gt;
&lt;br&gt;
&amp;nbsp;integration range is from G=0 to G=infinity&lt;br&gt;
&lt;br&gt;
&amp;nbsp;the coefficients to be determined is a &amp; b&lt;br&gt;
&lt;br&gt;
This equation is a integral of product of a Lorenz &amp; a Gaussian.</description>
    </item>
    <item>
      <pubDate>Sat, 10 Mar 2007 06:03:09 -0500</pubDate>
      <title>Re: fitting data to an integral</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213#360477</link>
      <author>John D'Errico</author>
      <description>B.K. Chen wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi, John,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My equation is show below:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; integral sign { [G/(x^2+G^2)] * exp[-(G-a)^2/2b^2] } dG&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; integration range is from G=0 to G=infinity&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; the coefficients to be determined is a &amp; b&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This equation is a integral of product of a Lorenz &amp; a Gaussian.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
So you have data where the integral&lt;br&gt;
is given as a function of x?&lt;br&gt;
&lt;br&gt;
As long as a/b&amp;gt;=10 or so, I'd try a&lt;br&gt;
Gauss-Hermite numerical quadrature&lt;br&gt;
inside the objective function. Then&lt;br&gt;
any optimizer will be fine. For&lt;br&gt;
smaller values of a/b, I'd just use&lt;br&gt;
quad over a finite set of limits,&lt;br&gt;
base the upper limit on the value&lt;br&gt;
of a/b.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Sat, 10 Mar 2007 06:25:12 -0500</pubDate>
      <title>Re: fitting data to an integral</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213#360478</link>
      <author>B.K. Chen</author>
      <description>&amp;gt; So you have data where the integral&lt;br&gt;
&amp;gt; is given as a function of x?&lt;br&gt;
&lt;br&gt;
Yeah~ It's a function of x. My data points are (x, f(x) )&lt;br&gt;
&lt;br&gt;
&amp;gt; As long as a/b&amp;gt;=10 or so, I'd try a&lt;br&gt;
&amp;gt; Gauss-Hermite numerical quadrature&lt;br&gt;
&amp;gt; inside the objective function. Then&lt;br&gt;
&amp;gt; any optimizer will be fine. For&lt;br&gt;
&amp;gt; smaller values of a/b, I'd just use&lt;br&gt;
&amp;gt; quad over a finite set of limits,&lt;br&gt;
&amp;gt; base the upper limit on the value&lt;br&gt;
&amp;gt; of a/b.&lt;br&gt;
&lt;br&gt;
In cftool(Create Custom Equation --&amp;gt; General Equations ),&lt;br&gt;
&amp;nbsp;it seems that we cannot input quadl directly , does it?&lt;br&gt;
&lt;br&gt;
B.K.</description>
    </item>
    <item>
      <pubDate>Sat, 10 Mar 2007 07:10:35 -0500</pubDate>
      <title>Re: fitting data to an integral</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/143213#360485</link>
      <author>John D'Errico</author>
      <description>B.K. Chen wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; So you have data where the integral&lt;br&gt;
&amp;gt;&amp;gt; is given as a function of x?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Yeah~ It's a function of x. My data points are (x, f(x) )&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; As long as a/b&amp;gt;=10 or so, I'd try a&lt;br&gt;
&amp;gt;&amp;gt; Gauss-Hermite numerical quadrature&lt;br&gt;
&amp;gt;&amp;gt; inside the objective function. Then&lt;br&gt;
&amp;gt;&amp;gt; any optimizer will be fine. For&lt;br&gt;
&amp;gt;&amp;gt; smaller values of a/b, I'd just use&lt;br&gt;
&amp;gt;&amp;gt; quad over a finite set of limits,&lt;br&gt;
&amp;gt;&amp;gt; base the upper limit on the value&lt;br&gt;
&amp;gt;&amp;gt; of a/b.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; In cftool(Create Custom Equation --&amp;gt; General Equations ),&lt;br&gt;
&amp;gt; it seems that we cannot input quadl directly , does it?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; B.K.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
I always thought I should learn to use&lt;br&gt;
that toolbox. But I wrote my own little&lt;br&gt;
gui tool for nonlinear regressions long&lt;br&gt;
before it existed, so my incentive was&lt;br&gt;
always pretty low. ;-)&lt;br&gt;
&lt;br&gt;
You should be able to supply your own&lt;br&gt;
function as an option. Have it call&lt;br&gt;
quadl. BUT BEWARE!!!!&lt;br&gt;
&lt;br&gt;
Do not try to integrate 0 to inf.&lt;br&gt;
Furthermore, use of any adaptive&lt;br&gt;
quadrature on an integrand that&lt;br&gt;
involves a gaussian term and where&lt;br&gt;
you cannot control the gaussian&lt;br&gt;
parameters will likely cause serious&lt;br&gt;
problems, culminating in a secondary&lt;br&gt;
request to this newsgroup.&lt;br&gt;
&lt;br&gt;
If you use a set of fixed integration&lt;br&gt;
limits, the optimizer can pass in&lt;br&gt;
any set of parameters (a,b) that it&lt;br&gt;
&quot;desires&quot;. If b is very small, the&lt;br&gt;
Gaussian part of the kernel becomes&lt;br&gt;
an effective Dirac delta, which the&lt;br&gt;
numerical integration will fail to&lt;br&gt;
&quot;see&quot;.&lt;br&gt;
&lt;br&gt;
This is why I suggested use of a&lt;br&gt;
Gauss-Hermite for large a/b. Only&lt;br&gt;
use quadl for the alternative case,&lt;br&gt;
and use a carefully chosen upper&lt;br&gt;
limit on the integration. You can&lt;br&gt;
find a nice tool for this purpose&lt;br&gt;
on the FEX:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;lt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=32&amp;objectType=file&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=32&amp;objectType=file&lt;/a&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
  </channel>
</rss>

