Take the 2-minute tour ×

Starting from the plot of one curve, it is possible to obtain the parametric equation of that curve?

In particular, say x={1 2 3 4 5 6....} the x axis, and y = {a b c d e f....} the corresponding y axis. I have the plot(x,y).

Now, how i can obtain the equation that describe the plotted curve? it is possible to display the parametric equation starting from the spline interpolation?

Thank you

share|improve this question
Parametric or polynomial? You need a corresponding 't' variable for parametric, unless you're assuming it's simply the element count. –  Doresoom Sep 30 '10 at 15:29
add comment

4 Answers

Last year, I wrote up a set of three blogs for Loren, on the topic of modeling/interpolationg a curve. They may cover some of your questions, although I never did find the time to add another 3 blogs to finish the topic to my satisfaction. Perhaps one day I will get that done.

The problem is to recognize there are infinitely many curves that will interpolate a set of data points. A spline is a nice choice, because it can be made well behaved. However, that spline has no simple "equation" to write down. Instead, it has many polynomial segments, pieced together to be well behaved.

share|improve this answer
add comment

If you want to display a polynomial fit function alongside your graph, the following example should help:

p=polyfit(x,y,3); %# third order polynomial fit, p=[a,b,c,d] of ax^3+bx^2+cx+d
yfit=polyval(p,x); %# evaluate the curve fit over x
hold on
equation=sprintf('y=%2.2gx^3+%2.2gx^2+%2.2gx+%2.2g',p); %# format string for equation
equation=strrep(equation,'+-','-'); %# replace any redundant signs
text(-1,-80,equation) %# place equation string on graph

alt text

share|improve this answer
Thank you for the very useful explaination! –  vittorio Oct 1 '10 at 8:35
add comment

You're asking for the function/mapping between two data sets. Knowing the physics involved, the function can be derived by modeling the system. Write down the differential equations and solve it.

Left alone with just two data series, an input and an output with a 'black box' in between you may approximate the series with an arbitrary function. You may start with a polynomial function


Given your input vector x and your output vector y, parameters a,b,c must be determined applying a fitness function.

There is an example of Polynomial Curve Fitting in the MathWorks documentation.

share|improve this answer
add comment

Curve Fitting Tool provides a flexible graphical user interfacewhere you can interactively fit curves and surfaces to data and viewplots. You can:

Create, plot, and compare multiple fits

Use linear or nonlinear regression, interpolation,local smoothing regression, or custom equations

View goodness-of-fit statistics, display confidenceintervals and residuals, remove outliers and assess fits with validationdata

Automatically generate code for fitting and plottingsurfaces, or export fits to workspace for further analysis

share|improve this answer
add comment

Your Answer


