×
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!

*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

interpolation in excell

interpolation in excell

interpolation in excell

(OP)
I am looking for a function in excell that interpolates the value in one column to the one in another!

My problem looks like this

Disp    wavelength
-76.0    1554
-77.5    1556
-79.1    1558
-80.8    1560
-82.5    1562
-84.3    1564
-86.2    1566
-88.2    1568
-90.2    1570
-92.4    1572
-94.7    1574
-97.1    1576
-99.6    1578
-102.2    1580


I am looking for a function that gives me wavelength as a function of dispersion for all dispersion values in the interval -70 to -102.

Does anyone have a solution to this

Jacob

Replies continue below

Recommended for you

RE: interpolation in excell

See the previos page of this forum, thread "Continious interpolation in excel" Thread770-13682.

RE: interpolation in excell

alternatively, the data you provided seems to fit pretty well on this curve:

y = -0.0114x^2 + 34.782x - 26554

where y is dispersion and x is wavelength, in whatever units you used for your posting.


RE: interpolation in excell

(OP)
I used the formula you suggested an the other thread and it worked fine.
I can't use the fit you suggested since I use more datapoints in the real dataset and a fit doesn't give values that are correct enough.
Thanks a lot for the help.
By the way is it possible to define a makro or function that will do the same and where I would just have to specify the dataset I want to interpolate and the value it should be interpolated at.

Jacob

RE: interpolation in excell

Jacob,
you can rewrite the formulas in the worksheet as a VBA function and use it straight from the worksheet

Public Function INTER1(Xval As Double, X As Range, Y As Range)
Dim Nrow%

Nrow = Application.WorksheetFunction.Match(Xval, X, IIf(X(1) > X(X.Count), -1, 1))
INTER1 = Y(Nrow) + (Xval - X(Nrow)) / (X(Nrow + 1) - X(Nrow)) * (Y(Nrow + 1) - Y(Nrow))

End Function


RE: interpolation in excell

(OP)
Thanks

Jacob

RE: interpolation in excell

Although previous responses will achieve results, there are standard Excel functions that will accomplish the same result.  In this case, the function is the "linest" function.  Please note the following:

Disp    wavelength        
-76    1554        
-77.5    1556        
-79.1    1558        
-80.8    1560        
-82.5    1562        
-84.3    1564        
-86.2    1566        
-88.2    1568        
-90.2    1570        
-92.4    1572        
-94.7    1574        
-97.1    1576        
-99.6    1578        
-102.2    1580        

-0.011158855    -2.972701541    1392.636695    #N/A
0.000305148    0.054237082    2.393678956    #N/A
0.99994583    0.066942506    #N/A    #N/A
101527.5568    11    #N/A    #N/A

=LINEST(D5:D18,C5:C18^{1,2},,TRUE)

The array shown above, with results, is an array formula to determine coefficients of 2nd degree polynominal.  The equation listed is the array formula, where column D are y-values and column C are x-values.  The first row of results are the coefficients (A2, A1, A0) for the 2nd degree polynominial.
FYI, Excel does have functions to determine coefficients of equations for a specified data.  Please read the Online Help regarding the Linest Function.  Not included in online help is method or technique to determine coefficients for various types of equations.
For this situation, data was plotted and a quadratic or 2-degree polynominial curve fit will suffice.  If not 2-degree, then simply add a ",3" (without quotes) after the "2" in linest function for a 3rd degree polynominial.
Enter the linest function as an array formula.  That means to: 1) highlight or select the range of cells (this case 4 rows x 4 columns) where formula is placed, 2) type in or use function wizard for linest function, using technique above, and 3) pressing ctrl+shift+enter.  See above example.  It is better to utilize the standard features of Excel than to writing functions to accomplish the same tasks.
I trust this helps.

RE: interpolation in excell

pmover,
Thanks for th insights of LINEST() function, I had no idea about its existence. The LINEST() Returns an array that describes a straight line that best fit your data, calculated by usnig the least squares method. The VBA function in the my earlier reply simply returns linearly interpolated value between two data points. Two different goals...

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! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close