Re: Equation of a curve



In article <ef178a2.-1@xxxxxxxxxxxxxxxx>, Vukani <vgebashe@xxxxxxxxx>
wrote:

> I've got a curve plotted using (x,y) co-ordinates, now i want to find
> an equation or equations of the curve. Something like y = x^3
> +4x-(65/4) for example. Such that if you substitute any value of x,
> it will give you the corresponding value of y. Please help.

The problem is, for any set of (x,y) pairs, there are
an infinite number of possible functions that interpolate
those points. If you choose to find a function that
merely fits the data with some error, there are even
more possibilities to choose between. ;-)

Some people tend to follow an approach of interpolation
for these problems. Spline models, as found most directly
in interp1, are a good choice. There are many others
available for the intrepid modeler. Of course, there
are also spline models one can apply for least squares
modeling.

Others lean toward the maximally simple - polynomial
models, both as interpolants and in a least squares
sense. They do have their adherants, although I'd rarely
recommend them. Look at polyfit for least squares, I
think there may be lagrange interpolants on the file
exchange.

Others go the route of series approximations or
interpolation. Polynomials are actually in this class,
but one can use Fourier series (fft is one place to
start) or many others, perhaps a bessel function series.

There are many other options available if you move into
a nonlinear regression domain.

My point is that you need to postulate a model, since
there are infinitely many possible valid choices. You
need to understand what your goals are, whether you
merely need to interpolate, or if you want to understand
something about the underlying functional relationship
in question. You need to recognize if there is error
in the data that needs to be smoothed.

If you don't want to do any of this, then just use
interp1.

HTH,
John D'Errico


--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945

Those who can't laugh at themselves leave the job to others.
Anonymous
.



Relevant Pages

  • Re: Sound paths and pathfinding.
    ... >> Jeff Lait wrote: ... > Then you'd interpolate between the nearest "key" squares to ... > find the four-space coordinates of all other squares. ...
    (rec.games.roguelike.development)
  • Questions on polynomial interpolation
    ... I am a physics PhD student. ... to introduce an `interpolation variable', i.e. to introduce a function $g$ and interpolate the modified set. ... which is much easier to do with polynomials. ... I have already consulted various books, including Powell, Approximation theory and methods, but I couldn't find precise answers. ...
    (sci.math.num-analysis)
  • Re: interpolation of measured data
    ... > how I got this data and what for I need to interpolate them. ... about the curve shape for any value of the first parameter. ... The best material model of a cat is another, or preferably the same, cat. ...
    (comp.soft-sys.matlab)
  • Re: How to find the area of 2 polynomials?
    ... difficulty to find the area of 2 different polynomials. ... the area bounded by 2curves(the polyfit curve and the original ... Simplest is to interpolate both curves ... want the exact solution, it is not too ...
    (comp.soft-sys.matlab)
  • Re: contouring irregularly spaced points.
    ... I have a 3000x4 matrix of longitude, latitude and say tidal ... define a rectangluar grid. ... The gridddata will interpolate ... The best material model of a cat is another, ...
    (comp.soft-sys.matlab)