I am attempting to fit an arctan curve, as a background fit, to a set
of data. I've read in the help manual how to fit polynomials and even
logarithmic functions, but cannot find anything on fitting an arctan
graph to data. I was wondering if this is at all possible, and if so
how it can be done.
I've also tried using the definition arctan = (i/2) * log[(i+x) / (i-
x)] to no avail.
"M@" <matthew.betti@gmail.com> wrote in message <4d2cd670-d8a1-
4098-8cac-8ec9ca321bac@f63g2000hsf.googlegroups.com>...
> Hello,
>
> I am attempting to fit an arctan curve, as a background fit, to a set
> of data. I've read in the help manual how to fit polynomials and even
> logarithmic functions, but cannot find anything on fitting an arctan
> graph to data. I was wondering if this is at all possible, and if so
> how it can be done.
>
> I've also tried using the definition arctan = (i/2) * log[(i+x) / (i-
> x)] to no avail.
>
> Thanks in advance,
> mb
In the name of god and little green apples,
why use a nasty definition like that, when
atan is already available in Matlab?
The optimization toolbox, and the curve
fitting toolbox are both available for the
task of fitting expressions to data. Or, if
you have the stats toolbox, then use nlinfit.
If not, then use one of the many tools on
the File Exchange, like ezyfit, or my own
fminspleas.
On Jul 15, 10:46=A0am, "John D'Errico" <woodch...@rochester.rr.com>
wrote:
> "M@" <matthew.be...@gmail.com> wrote in message <4d2cd670-d8a1-
>
> 4098-8cac-8ec9ca321...@f63g2000hsf.googlegroups.com>...
>
> > Hello,
>
> > I am attempting to fit an arctan curve, as a background fit, to a set
> > of data. =A0I've read in the help manual how to fit polynomials and eve=
n
> > logarithmic functions, but cannot find anything on fitting an arctan
> > graph to data. =A0I was wondering if this is at all possible, and if so
> > how it can be done.
>
> > I've also tried using the definition arctan =3D (i/2) * log[(i+x) / (i-
> > x)] to no avail.
>
> > Thanks in advance,
> > mb
>
> In the name of god and little green apples,
> why use a nasty definition like that, when
> atan is already available in Matlab?
>
> The optimization toolbox, and the curve
> fitting toolbox are both available for the
> task of fitting expressions to data. Or, if
> you have the stats toolbox, then use nlinfit.
> If not, then use one of the many tools on
> the File Exchange, like ezyfit, or my own
> fminspleas.
>
> http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?
> objectId=3D10176&objectType=3Dfile
>
> http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?
> objectId=3D10093&objectType=3DFILE
>
> John
I have attempted using both programs, and while they are both
exceptional at what they do, neither seems to work quite right for my
data.
My problem is more complicated than I originally stated, I was hoping
I could get a brief answer while sparing all of you the boring
details. The problem is that I have a set of data that follows the
basic form of an arctan curve, but there are several peaks in the
data. My goal is to use a fitted arctan curve which ignores the peaks
so that I can subtract the fitted arctan curve from my data set, and
as such have just the peaks left without any background noise. These
peaks then must be deconvoluted into three separate Gaussian
distributions. The latter part is not so much an issue. The real
issue is trying to get a fit to ignore the peaks in the data and thus
giving me an arctan curve which fits the background "noise".
Thank you very much for your suggestions John, and anyone else in
advance for their input.
M@ wrote:
...
> ... My goal is to use a fitted arctan curve which ignores the peaks
> so that I can subtract the fitted arctan curve from my data set, and
> as such have just the peaks left without any background noise. ...
But it can't "ignore the peaks" unless there's corollary information
available--the fitting is to total minimized error and the largest error
is in the location of the peaks if try to fit the background only.
In doing such a problem in previous life, we used a combination of a
linear portion for background and nonlinear (Marquardt algorithm) to fit
the Gaussian portion. The separation in that case between using a
combined fully nonlinear combinational routine trying to fit both using
the nonlinear routine only was very effective.
Depending on the shape of the background and the amount of overlap in
peaks and half-width, etc., etc., etc., you might be able to do an
initial background estimation by segregating out the regions w/ peaks
entirely--I've seen it work w/ certain spectra, not so much w/ our
particular case where the data was from NaI crystal so very much smeared...
dpb <none@non.net> wrote in message <g5iiho$4n9$1@aioe.org>...
> M@ wrote:
> ...
> > ... My goal is to use a fitted arctan curve which
ignores the peaks
> > so that I can subtract the fitted arctan curve from my
data set, and
> > as such have just the peaks left without any background
noise. ...
>
> But it can't "ignore the peaks" unless there's corollary
information
> available--the fitting is to total minimized error and the
largest error
> is in the location of the peaks if try to fit the
background only.
>
> In doing such a problem in previous life, we used a
combination of a
> linear portion for background and nonlinear (Marquardt
algorithm) to fit
> the Gaussian portion. The separation in that case between
using a
> combined fully nonlinear combinational routine trying to
fit both using
> the nonlinear routine only was very effective.
>
> Depending on the shape of the background and the amount of
overlap in
> peaks and half-width, etc., etc., etc., you might be able
to do an
> initial background estimation by segregating out the
regions w/ peaks
> entirely--I've seen it work w/ certain spectra, not so
much w/ our
> particular case where the data was from NaI crystal so
very much smeared...
>
> --
>
>
> --
fun = @(c,x)
c(1)+c(2)*atan((x-c(3))/c(4))+c(5)*exp(-((x-c(6))./c(7)).^2)
> I have attempted using both programs, and while they are both
> exceptional at what they do, neither seems to work quite right for my
> data.
>
> My problem is more complicated than I originally stated, I was hoping
> I could get a brief answer while sparing all of you the boring
> details. The problem is that I have a set of data that follows the
> basic form of an arctan curve, but there are several peaks in the
> data. My goal is to use a fitted arctan curve which ignores the peaks
> so that I can subtract the fitted arctan curve from my data set, and
> as such have just the peaks left without any background noise. These
> peaks then must be deconvoluted into three separate Gaussian
> distributions. The latter part is not so much an issue. The real
> issue is trying to get a fit to ignore the peaks in the data and thus
> giving me an arctan curve which fits the background "noise".
>
> Thank you very much for your suggestions John, and anyone else in
> advance for their input.
Maybe a "robust" technique would work well for you. Two that I can
think of are robust least squares and RANSAC
This makes sense if the peaks are fairly narrow, so that by considering
all of the samples within a peak to be outliers, you can get the right
answer with what is left.
-Peter
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.