×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Convert measured data into equation

Convert measured data into equation

Convert measured data into equation

(OP)
Hi, i have some measured data, that when you plot them will result in a 3rd order polynomium.

Anyone know of a way to calculate the 3rd order coefficients???

RE: Convert measured data into equation

You use any of a number of statistical analysis routines that can be found in Excel, Mathcad, Matlab, TKSolver, Mathematica, Calculation Center, SPSS, etc.

TTFN



RE: Convert measured data into equation

(OP)
I have to make the conversion in my .NET application :(

RE: Convert measured data into equation

Then get a copy of Numerical Recipes and start reading

TTFN



RE: Convert measured data into equation

A quick way in excel or MATLAB or C++ is to create a matrix of power of your x axis coordinates and then invert it.  For instance, if your data is equally spaced at points x = 0.1, 1.1, 2.1, and 3.1 then you would make a matrix of x to the zero power, first power, second power and finally the third power.

X = 1 0.1 0.1^2 0.1^3
    1 1.1 1.1^2 1.1^3
    1 2.1 2.1^2 2.1^3
    1 3.1 3.1^2 3.1^3

The inver X using excel or inv in MATLAB or 1 / X in the TNT (Template Numerical Toolkit) available for free on the net for C++.

if your data is
y = 5.3 6.3 7.3 8.3

Then you would multiply y as a column vector by inv(x) to get your coefficients.

c = y * X^-1

This is only OK for "good" data with less than 10 points.  If you have more points you should use a numerically better solution as suggested by
IRstuff
as in Numerical Recipes
or the TNT library
or the MATLAB backslash or QR functions.  You would also want to augment them as explained in the literature.

RE: Convert measured data into equation

The technique you want is called least squares system identification.  Visigoth has the right idea on how you set up the array phi array.  The least squares system identication requires matrix mulitplication and inversion.  As stated above, this is easy with math cad.  Excel has a built in function called LINEST.   A matrix class for C++ also makes this function easy.

RE: Convert measured data into equation

If you have an Excel, plot your points as X-Y scatter graph.With you mouse pointer right click on a point on the graph and choose
Format Data Series
     Custom.
You will get a line through the points.R-click on the line and you will get a form Add Trendline.
Under Type choose Polynomial, Order 3;
under Options choose Display Equation On Chart
and you'll get it!
If you want a differently formated result then right clickt he result, choose FormatData Labels and then choose one of the available formats (number, scientific..).
You can copy the result into a cell on a sheet but however the result is written as a string of chracters so you need some work to separate constants of the polynomial as individual values in particular cells.
m777182
  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources