Re: Equation of a curve
- From: John D'Errico <woodchips@xxxxxxxxxxxxxxxx>
- Date: Sat, 08 Oct 2005 12:35:33 GMT
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
.
- References:
- Equation of a curve
- From: Vukani
- Equation of a curve
- Prev by Date: Re: how to establish communication between VC++ and MATLAB
- Next by Date: Re: nonlinear optimization
- Previous by thread: Re: Equation of a curve
- Next by thread: ARMA parameter estimation
- Index(es):
Relevant Pages
|