# Help finding a polynomial function given a set of data

• saybrook1
In summary, the conversation discusses a set of data with x and y coordinates as well as a z coordinate representing power density. The person is looking for help in finding a function for z in terms of x and y using this data. Suggestions are made to use a polynomial or bivariate splines, but it is noted that the large number of data points may lead to overfitting. The person eventually finds a way to interpolate and apply the data in third party software. The accuracy of the data is also praised and the possibility of sending a private message is discussed.
saybrook1

## Homework Statement

Hello guys, I have a set of data containing x and y coordinates(width and length) as well as a 'z' coordinate that represents power density at each point of x and y given. I was hoping that someone might be able to help me figure out a way that I can find a function for z in terms of x and y given all of the data points. Perhaps MATLAB or mathematica has a way of doing it, although I have not found it yet. I will include a snapshot of some of the data although it is extensive. Also, the number of width data points are larger than the number of length data points if that makes a difference. Thank you very much

## Homework Equations

Polynomial function for z in terms of x and y given the data[/B]

## The Attempt at a Solution

Looked around the web for quite some time on how to figure this out without brute force and couldn't find any solid answers.

#### Attachments

• fit to z.png
42 KB · Views: 373
You have 72 data points. It's trivial to fit a 72-degree polynomial to that, but that's very unlikely to be realistic, and may behave badly in interpolation and extrapolation.

What is usually done is to use one's a priori expectations of the relationships between x, y and z to create a model, which is an equation that gives z in terms of y and z, together with a number of unknown parameters, in a way that has some intuitive basis in the underlying physical phenomena. Having guessed a model, the data can then be used to estimate the parameters based on an approach of minimising residuals.
The polynomial approach has 72 unknown parameters, which leads to a grossly overfitted curve. Typically, one would only want a few parameters to estimate - say two to six.

What is the physical context? That should suggest a promising model.

Congratulations! I have never seen such precise experimental data.

If you drew the graph of the points, but don't trouble to be more than two-place accurate, you and we might have an idea what degree of polynomial it would make sense to try and fit them to.

I wouldn't think you would want a polynomial fit. Not particularly my field, but I would suggest you look at bivariate splines. The quadratic Shepard's method is one that comes to mind. Lots of info on the internet. Look up QSHEP2D.

Hey guys, I apologize for taking so long to respond and I really appreciate your responses. There are actually many many more data points than in the sample that I posted. I ended up being able to export the data from excel and interpolate/apply it to my model in third party software. Thanks again for your help!

Could you show us any result?

andrewkirk
epenguin said:
Could you show us any result?
Let me get back to you on that! Feel free to remind me or pm if I forget.

saybrook1 said:
Let me get back to you on that! Feel free to remind me or pm if I forget.

As said by "epenguin", you are to be congratulated for the accuracy of the experimental data. Your length and width measurements are accurate to within a small fraction of the diameter of a hydrogen atom. What sort of measuring device did you use?

Ray Vickson said:
As said by "epenguin", you are to be congratulated for the accuracy of the experimental data. Your length and width measurements are accurate to within a small fraction of the diameter of a hydrogen atom. What sort of measuring device did you use?
Thank you, the results are however not mine; I am using the data to help model something.

I guess you cannot send a pm on these forums.

saybrook1 said:
I guess you cannot send a pm on these forums.
You can, but they're called Conversations here rather than PM.
To do one, hover your mouse over INBOX on the top menu. In the pop-up menu that appears, a 'Start a New Conversation' link is in the bottom right corner.

andrewkirk said:
You can, but they're called Conversations here rather than PM.
To do one, hover your mouse over INBOX on the top menu. In the pop-up menu that appears, a 'Start a New Conversation' link is in the bottom right corner.
Ahh okay, thank you very much.

## 1. How do I find a polynomial function given a set of data?

To find a polynomial function given a set of data, you will need to use a process called polynomial regression. This involves using the data points to create a mathematical equation that best fits the data. This equation will be your polynomial function.

## 2. What is the process for polynomial regression?

The process for polynomial regression involves the following steps:

• Plot the data points on a graph
• Determine the degree of the polynomial function (the highest exponent of the variable)
• Create a system of equations using the data points
• Solve the system of equations to find the coefficients for the polynomial function
• Write out the polynomial function using the coefficients found

## 3. Can I use any degree polynomial function for my data set?

Yes, you can use any degree polynomial function for your data set. However, it is important to keep in mind that the degree of the polynomial function should be chosen based on the complexity of the data. A higher degree polynomial may fit the data better, but it may also lead to overfitting and inaccurate predictions.

## 4. How do I know if the polynomial function I found is the best fit for my data?

To determine if the polynomial function is the best fit for your data, you can use a statistical measure called the coefficient of determination (R-squared). This value ranges from 0 to 1 and indicates the percentage of the variation in the data that is explained by the polynomial function. A higher R-squared value indicates a better fit.

## 5. Can I use a polynomial function to predict values outside of my data set?

Yes, you can use a polynomial function to make predictions for values outside of your data set. However, it is important to keep in mind that the accuracy of these predictions decreases as you move further away from the data points used to create the polynomial function. It is always recommended to use caution when making predictions outside of the data range.

• Calculus and Beyond Homework Help
Replies
4
Views
1K
• Calculus and Beyond Homework Help
Replies
9
Views
1K
• Calculus and Beyond Homework Help
Replies
9
Views
1K
• Calculus and Beyond Homework Help
Replies
8
Views
581
• Calculus and Beyond Homework Help
Replies
17
Views
1K
• Calculus and Beyond Homework Help
Replies
4
Views
753
• Calculus and Beyond Homework Help
Replies
14
Views
600
• General Math
Replies
4
Views
1K
• Calculus and Beyond Homework Help
Replies
1
Views
527
• Calculus and Beyond Homework Help
Replies
3
Views
571