Finding a Program to Fit a Polynomial to Data

In summary: D is a non-linear function.In summary, DataFit can be used to fit a polynomial to a set of data. However, the model needs to be found first.
  • #1
el_hijoeputa
19
0
Please tell me if some of you know of a way, or program that I can download or use to fit a given polynomial to a set of data.

I have done an experiment in which I varied two currents thru wires (Ix, Iy) and measured the Temperature at a given point (T). The polynomial is known from a model (I still don't know it for sure), but let's say that it is:

T = a+ b(Ix) + c(Iy) + d(Ix)^4 + e(Iy)^4

I need to obtain the value of this polynomial, because the current where measured (Ix from 0 to 8, Iy from 0 to 8), and I need values in the range of Ix=8, Iy=10 (Extrapolate).

Most of the programs I used for data manipulation fit polynomial for 2D curves (only one variable), not surfaces.
 
Physics news on Phys.org
  • #2
I found a program that does it. DataFit, from http://www.curvefitting.com/

Now I only need to work on the model.

Where and what can I read to solve the problem of obtaining the temperature at a distance from a wire with a current passing thru it?
 
  • #3


Well, you could try to use linear algebra... let's say you need to fit the points

(5,2,3)
(9,2,4)
(10,-3,7)
(-3,2,6)
(9,8,2)

Suppose your function is in the form

z = Ax + By + C

So, we have three variables, but 5 equations. If you consider the matrix

[tex]
M =
\begin{bmatrix}
5&2&1\\
9&2&1\\
10&-3&1\\
-3&2&1\\
9&8&1
\end{bmatrix}
[/tex]

and the matrix

[tex]
b =
\begin{bmatrix}
3\\
4\\
7\\
6\\
2\\
\end{bmatrix}
[/tex]

you'll find that the equation

[tex]Ax = b[/tex]

where

[tex] x =

\begin{bmatrix}
A\\
B\\
C\\
\end{bmatrix}
[/tex]

models the situation in terms of simultaneous equations which we are trying to solve. Now obviously, we can't find A,B,C such that all of these equations are satisfied. So, we will try to find the best values for A,B,C. This works if we solve

[tex]M^T M x = M^T b[/tex]

Note that the left hand side yields a square matrix which is invertible while the right hand side yields a column vector. If we solve this, we get: A = -0.102656, B = -0.454035, C = 6.01481. Thus, this plane best models the given points: Ax + By + C = z, where I just stated the values for A, B, C. Now, a question you may have is, why did I multiply both sides by M transpose? This has to do with the projection of rowspaces onto other subspaces. Read a linear algebra book to find out why :P The cool part about this is you can extend the models to n dimensions and in addition, your models don't necessarily have to be lines, or planes. It could even be something like

[tex]z = Ax^23 - Be^x + C \sin x - D[/tex]
 

1. What is polynomial fitting and why is it important?

Polynomial fitting is a mathematical technique used to find a curve that best fits a set of data points. It is important because it allows us to make predictions and analyze trends from data that may not have a clear linear relationship.

2. How do I know which degree of polynomial to use?

The degree of polynomial to use depends on the complexity of the data. A higher degree polynomial may fit the data better, but it can also lead to overfitting and inaccurate predictions. It is important to balance the complexity of the polynomial with the accuracy of the fit.

3. What are the common methods for finding a program to fit a polynomial to data?

Some common methods for polynomial fitting include the Least Squares Method, the Newton's Method, and the Lagrange Interpolation Method. Each method has its own advantages and disadvantages, and the choice will depend on the specific needs and data set.

4. How can I evaluate the quality of the polynomial fit?

The quality of the polynomial fit can be evaluated by calculating the residual sum of squares (RSS) or the coefficient of determination (R-squared). These metrics measure the difference between the actual data points and the predicted values from the polynomial fit.

5. Are there any limitations to polynomial fitting?

Yes, there are some limitations to polynomial fitting. It is not suitable for all types of data and can lead to overfitting if not used properly. Additionally, polynomial fitting may not be appropriate for data sets with large outliers or noise.

Similar threads

Replies
33
Views
3K
  • Advanced Physics Homework Help
Replies
11
Views
1K
  • Electrical Engineering
Replies
2
Views
740
  • Programming and Computer Science
Replies
4
Views
874
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
  • General Math
Replies
6
Views
786
  • Programming and Computer Science
Replies
1
Views
869
  • General Math
Replies
2
Views
723
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
28
Views
3K
Back
Top