Main Page | Report this Page
 
   
Science Forum Index  »  Math - Numerical Analysis Forum  »  Interpolation of a dataset
Page 1 of 1    
Author Message
Thomas Korsgaard
Posted: Thu Mar 15, 2007 9:14 am
Guest
Hi,

I have a set of data, that when plotted looks like this:

http://www.student.dtu.dk/~s011564/scurve.png

I believe that it looks like a S-curve, but I'm not sure. Please correct
my if I'm wrong.

I would like to interpolate this so I could get a function. I've been
trying in Maple, but it gives me a 15 drgree polynomial.
The thing is that I dont want Y to be come 1 or -1 no matter how large X
becomes.

Is there any good way to do this, or is there a special was to
interpolate a S-curve?

Thanks
/Thomas
Gordon Sande
Posted: Thu Mar 15, 2007 9:50 am
Guest
On 2007-03-15 11:14:50 -0300, Thomas Korsgaard <tk@imm.dtu.dk> said:

Quote:
Hi,

I have a set of data, that when plotted looks like this:

http://www.student.dtu.dk/~s011564/scurve.png

I believe that it looks like a S-curve, but I'm not sure. Please
correct my if I'm wrong.

I would like to interpolate this so I could get a function. I've been
trying in Maple, but it gives me a 15 drgree polynomial.
The thing is that I dont want Y to be come 1 or -1 no matter how large
X becomes.

Is there any good way to do this, or is there a special was to
interpolate a S-curve?

Thanks
/Thomas

A quick first cut would be to try a rescaled hyperbolic tangent.
Since you want limits of +1 and -1 and 0 at 0 that leaves only
one parameter. So fit a in

f(x) = tanh( a x ).

Tanh is a often used as an analytic approximation to a step function.
This should get you started.
Richard Harter
Posted: Thu Mar 15, 2007 11:33 am
Guest
On Thu, 15 Mar 2007 15:14:50 +0100, Thomas Korsgaard <tk@imm.dtu.dk>
wrote:

Quote:
Hi,

I have a set of data, that when plotted looks like this:

http://www.student.dtu.dk/~s011564/scurve.png

I believe that it looks like a S-curve, but I'm not sure. Please correct
my if I'm wrong.

I would like to interpolate this so I could get a function. I've been
trying in Maple, but it gives me a 15 drgree polynomial.
The thing is that I dont want Y to be come 1 or -1 no matter how large X
becomes.

Is there any good way to do this, or is there a special was to
interpolate a S-curve?

The thing is, no polynomial or ratio of polynomials is going to fit an
S-curve. You can fit an S-curve with an arctangent function or with the
logistic function e**x/1+e**x. It looks as though the derivative of
your data goes asymptotic at 0; there is a function that is good for
that but I don't recall what it is off hand. If you like I can muzz
around a bit and come up with it.

In general, yes, you have to do something special with an S-curve. I
suspect that Maple has something but I wouldn't know what it is.

Hope this helps.
Robert Israel
Posted: Thu Mar 15, 2007 2:09 pm
Guest
Gordon Sande <g.sande@worldnet.att.net> writes:

Quote:
On 2007-03-15 11:14:50 -0300, Thomas Korsgaard <tk@imm.dtu.dk> said:

Hi,

I have a set of data, that when plotted looks like this:

http://www.student.dtu.dk/~s011564/scurve.png

I believe that it looks like a S-curve, but I'm not sure. Please
correct my if I'm wrong.

I would like to interpolate this so I could get a function. I've been
trying in Maple, but it gives me a 15 drgree polynomial.
The thing is that I dont want Y to be come 1 or -1 no matter how large
X becomes.

Is there any good way to do this, or is there a special was to
interpolate a S-curve?

I really think you want to fit, rather than interpolate, the curve.

Quote:
Thanks
/Thomas

A quick first cut would be to try a rescaled hyperbolic tangent.
Since you want limits of +1 and -1 and 0 at 0 that leaves only
one parameter. So fit a in

f(x) = tanh( a x ).

Tanh is a often used as an analytic approximation to a step function.
This should get you started.

Another possibility would be f(x) = 2/pi arctan(a x). One difference
between these is that tanh(a x) approaches (+/-)1 exponentially
as x -> (+/-) infinity, while 2/pi arctan(a x) approaches more slowly
(arctan(a x) = pi/2 - 1/(a x) + O(1/x^3)).

Perhaps the next thing to do would be to plot arctanh(y) (in
the first case) or tan(pi y/2) (in the second) against x and see if
either looks like a straight line, or some other curve that you might
fit.
--
Robert Israel israel@math.MyUniversitysInitials.ca
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada
Ray Koopman
Posted: Thu Mar 15, 2007 7:24 pm
Guest
On Mar 15, 9:33 am, c...@tiac.net (Richard Harter) wrote:
Quote:
On Thu, 15 Mar 2007 15:14:50 +0100, Thomas Korsgaard <t...@imm.dtu.dk
wrote:



Hi,

I have a set of data, that when plotted looks like this:

http://www.student.dtu.dk/~s011564/scurve.png

I believe that it looks like a S-curve, but I'm not sure. Please correct
my if I'm wrong.

I would like to interpolate this so I could get a function. I've been
trying in Maple, but it gives me a 15 drgree polynomial.
The thing is that I dont want Y to be come 1 or -1 no matter how large X
becomes.

Is there any good way to do this, or is there a special was to
interpolate a S-curve?

The thing is, no polynomial or ratio of polynomials is going to fit an
S-curve. You can fit an S-curve with an arctangent function or with the
logistic function e**x/1+e**x. It looks as though the derivative of
your data goes asymptotic at 0; there is a function that is good for
that but I don't recall what it is off hand. If you like I can muzz
around a bit and come up with it.

In general, yes, you have to do something special with an S-curve. I
suspect that Maple has something but I wouldn't know what it is.

Hope this helps.

Try (tanh(a x))^b or (2/pi arctan(a x))^b, where b (e.g., 1/3)
is interpreted as odd so that the sign is preserved.
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Thu Jan 08, 2009 3:08 am