Choosing the Right Interpolation Method for Your Data: A Guide for Engineers

  • A
  • Thread starter confused_engineer
  • Start date
  • Tags
    Interpolation
In summary, interpolation is not appropriate for this situation because the data is not noise-free. It might be better to use a linear fit instead.
  • #1
confused_engineer
39
2
TL;DR Summary
I have a matrix of data and X, Y position where it was recorded. I want to find out a suitable interpolation polinomial but I don't know how to obtain one of reasonable order.
Hello everyone.

I have a vector of size 300321*3; the columns are X position, Y position and recorded data; I need to find the interpolation polynomial. I have acess to mathematica, MATLAB and python.

I have attempted to use a NonlinearModelFit in mathematica, but I cannot achieve a Rsquared superior to 0.6 by constructing models by hand, that is why I want to use the interpolation polynomial instead. However, if I use the InterpolatingPolynomial function, my computer crashes and even if it didn't, the result would be useless since a polinomial of order 300321 would make no sense.

In Matlab, I have tested the function griddedinterpolant, which produces good results, however, the function does not return a polynomial, but only a grid with more points instead, these aditional ones calculated using the interpolation and located between the originaly provided.

Can someone please advice me on how to proceed?

Regards.
Confused engineer
 
Physics news on Phys.org
  • #2
Do you have some theoretical relationship between x, y, and z? If not then why do you expect an R^2 greater than 0.6?

Also, why are you doing a nonlinear fit in the first place? Usually you only do nonlinear fits if you have a nonlinear model in mind for theoretical reasons.

An interpolation seems like a bad idea. Interpolation almost never makes sense unless your data is noise-free. With your R^2 value that seems unlikely. You should be looking at fitting the data to a model:

Do you have a theoretically motivated model? If not then a simple linear model is probably best.
 
Last edited:
  • Like
Likes confused_engineer
  • #3
Dale said:
Do you have some theoretical relationship between x, y, and z? If not then why do you expect an R^2 greater than 0.6?

Also, why are you doing a nonlinear fit in the first place? Usually you only do nonlinear fits if you have a nonlinear model in mind for theoretical reasons.

An interpolation seems like a bad idea. Interpolation almost never makes sense unless your data is noise-free. With your R^2 value that seems unlikely. You should be looking at fitting the data to a model:

Do you have a theoretically motivated model? If not then a simple linear model is probably best.
First of all, thanks for the answer.

Second, my data doesn't have noise, since the data is the output of a prediction model (I don't know anything about it's internal working, only the output file), so I will try the lineal way instead.

About the use of interpolation instead of the fit, I do it because my professor insisted on using it instead of fitting the data.

And about the theoretical model, no I don't have one. I just attempted to use higher order terms to have a better fit.
 
  • #4
confused_engineer said:
Second, my data doesn't have noise, since the data is the output of a prediction model (I don't know anything about it's internal working, only the output file),
Oh, that is different. Then interpolation does make sense. You might try something like a cubic spline interpolation. In Mathematica you can just use the Interpolation function.
 
  • #5
The thing is that I cannot use piecewise interpolation, the result goes then into ampl, an optimization software (in which I am calculating the fastest route) which needs to know the value of the windspeed at all points. I need an algebraic expression of the windspeed, in this case, my f(x,y).

In the attached file you can find my model so far.
pforum.png
 
  • #6
confused_engineer said:
which needs to know the value of the windspeed at all points.
Do you have a link to documentation that says the subprogram you are using requires windspeed as an algebraic expression?

The usual case in computer software would be that an optimization needs functions in the computer language sense of the word "function". Such a function can be created by writing a routine using any type of algorithm. It need not employ an algebraic expression.
 
  • #7
Stephen Tashi said:
Do you have a link to documentation that says the subprogram you are using requires windspeed as an algebraic expression?

The usual case in computer software would be that an optimization needs functions in the computer language sense of the word "function". Such a function can be created by writing a routine using any type of algorithm. It need not employ an algebraic expression.
Don't worry. In the end, I found out a way to do it using Shannon sampling in two dimensions. However, I am running in some issues, but I think they deserve their own thread
 
  • #8
Nomenclature: An interpolation necessarily passes exactly through each data point.
I believe that is not what you want. Instead you are looking to fit the data to a function with presumably some measure of fit quality maximized. In the age of Google semantic precision is important.
Have you looked at the data?? Is it bumpy or smooth? (does ii have lots of local maxima or not? ) That will indicate the order of a polynomial fit needed.
Shannon Sampling is essentially doing a finite Fourier series fit. It may or may not be an effective method. There is no "right " answer here .
 

1. What is interpolation?

Interpolation is a mathematical technique used to estimate values between two known data points. It involves creating a function that passes through these data points, allowing us to estimate the value of a data point that falls in between.

2. Why is interpolation important in scientific research?

Interpolation allows us to fill in missing data points and make predictions based on existing data. This is especially useful in scientific research where data may be limited or incomplete, but we still need to draw conclusions and make predictions.

3. What are the different types of interpolation methods?

The most common types of interpolation methods are linear, polynomial, and spline. Linear interpolation uses a straight line to connect two data points, while polynomial interpolation uses a curved line. Spline interpolation uses a series of polynomial functions to connect data points in a smooth manner.

4. What are the limitations of interpolation?

Interpolation assumes that the data points are evenly spaced and that there is a smooth relationship between them. This may not always be the case, and in such situations, interpolation may not accurately represent the data. Additionally, interpolation cannot predict values outside of the range of the existing data points.

5. How can I ensure the accuracy of my interpolation results?

The accuracy of interpolation results depends on the quality and quantity of the data points. To ensure accuracy, it is important to have a sufficient number of data points that are evenly spaced and cover the entire range of the data. It is also important to choose an appropriate interpolation method for the type of data being analyzed.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
732
  • Electrical Engineering
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
887
Replies
1
Views
2K
  • General Math
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
Replies
1
Views
2K
  • Biology and Medical
Replies
5
Views
766
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Back
Top