# Fitting a hyperbola to data

• Feb 7th 2010, 11:53 PM
henxan
Deducing formula for hyperbola from asymptotes
Hi!

I have some data which I want to fit a hyperbola to, but i do not know how to?!?!

My exact question would be: If i know the asymptotes, can i construct a hyperbola which fits?

I am using cartesian coordinates, and switching to another system is out of the question.

Below is picture illustrating the data:
Attachment 15301

Thnx :)
• Feb 8th 2010, 12:37 AM
pickslides
It is best to use a computer for this many data points, do you have any software packages? ms excel should do the job.
• Feb 8th 2010, 12:45 AM
henxan
Problem not so much "fitting" as "finding form of formula"
Quote:

Originally Posted by pickslides
It is best to use a computer for this many data points, do you have any software packages? ms excel should do the job.

Thnx for the reply. :).. The problem is not fitting the data, it's figuring out a hyperbola which follows the asymptotes.

The program I intend to use is GNUplot, which seem to work fine. My problem is finding a hyperbola which has the form of:

a*x+b when x->-infinity
C when x-> +infinity

So what i really need to know is a cartesian method of deducing the formula for a hyperbola based on the asymptotes (Worried)
• Feb 8th 2010, 12:57 AM
pickslides
Quote:

Originally Posted by henxan
The program I intend to use is GNUplot, which seem to work fine. My problem is finding a hyperbola which has the form of:

I'm sorry I don't know this program, i'm sure there would be an option that gives you the equation you are looking for.

Quote:

Originally Posted by henxan
Thnx for the reply. :).. The problem is not fitting the data, it's figuring out a hyperbola which follows the asymptotes.

Once it has given you the equation it will probably be in the form

$y=\frac{a}{x-b}+c$ where b is the vertical and c is the horizontal asymptotes.
• Feb 8th 2010, 03:31 AM
henxan
Well, the problem is that the vertical asymptote of the hyperbola is not vertical but diagonal (Worried)..

I have tried searchin all over the interwebz, but nothing helpful. GNUplot only takes functions for trendlines, retrofitting them to the data. Other programs, at least Excel, is absolutely useless in suggesting trends for the data. (Worried)
• Feb 8th 2010, 11:16 AM
Opalg
Quote:

Originally Posted by henxan
I have some data which I want to fit a hyperbola to, but i do not know how to?!?!

My exact question would be: If i know the asymptotes, can i construct a hyperbola which fits?

If the sloping asymptote has equation ax + by + c = 0, and the other asymptote is the horizontal line y = d, then the equation of the hyperbola will be $(y-d)(ax + by + c) = k$, for some constant k.
• Feb 9th 2010, 12:17 AM
henxan
The SOLUTION!!! :D
Quote:

Originally Posted by Opalg
If the sloping asymptote has equation ax + by + c = 0, and the other asymptote is the horizontal line y = d, then the equation of the hyperbola will be $(y-d)(ax + by + c) = k$, for some constant k.

Hi, and thanks for the reply!

I actually discovered the solution myself yesterday. Firstly I happend on the webpage http://cs.jsu.edu/~leathrum/Mathlets/conics.html ... I then fiddled around with the constants and discovered something like this:

2xy+y^2-F=0 (ERROR CORRECTED: y->y^2)

Solving this for y gave me

y=sqrt(x^2-F)-x

taking consideration to x and y offset, plus scaling gave me:
y=(sqrt((b-x)^2-c) - x)*a+d

OR, the correct expression in GNUplot:
f(x)=(a*(sqrt((b-x)**"+c)-x)+d)

Where
a): vertical scaling
b): x-offset
c): constant connected to the focal point (curving)
d): y-offset

Then I solved this out in GNUplot

fit [x=minimum_x_value:max_x_value] f(x) "tempendata.dat"(my datafile) via a,b,c,d

And this is what came out:
Attachment 15315

I seem pretty satisfied now :D