Linear Program Polynomial Interpolation Excel
Posted in:admin
I tried to find something like the attached macro on the internet for my own use, but could not. So I wrote it. I hope others find it of use. The OpenOffice version of the macro is listed first, followed by the Excel VBA conversion.
Macro function PINTERP interpolates X-Y data tables arranged in either column or row format. PINTERP is especially suitable for very large spreadsheet data tables, because it uses an efficient bi-section search to bracket the value to be interpolated, and uses the average of the two possible quadratic interpolation polynominals over the nearest 4 data points in the table instead of a cubic spline. This approach appears as accurate as cubic interpolation for equally spaced points, and better than quadratic interpolation for non equally spaced points, but does not require solution of the cubic spline matrix for every function call, which would quickly become a problem if pasted to a huge table sending different data sets on every call. OpenOffice Calc Version (Not Excel Compatible - See below for Excel VBA Version): Code: Function PINTERP(xtab, ytab, x, Optional Linear) ' ' PINTERP Version 1.0.0 ' ' OpenOffice.org Calc BASIC Spreadsheet Interpolation Macro ' ' Copyright (C) 2010 Eric J.
Hitachi Excavator Service Manual Pdf there. Geyer ' ' This PINTERP function is free software: you can redistribute it ' and/or modify it under the terms of the GNU Lesser General Public ' License as published by the Free Software Foundation, either ' version 3 of the License, or (at your option) any later version. ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the ' GNU Lesser General Public License for more details. ' ' You should have received a copy of the GNU Lesser General Public License ' along with this program. Geyer ' geyerej@gmail.com ' 405 Lippershey Ct. ' Cary, NC 27513 ' ' Input: ' xtab: array of n x values ' ytab: array of n y values ' x: interpolant ' Linear: optional boolean; forces linear interpolation if >0 ' ' Output: ' y: interpolated y at x ' ' Interpolation method: ' n=2: linear ' n=3: quadratic ' n>3: average of two possible quadratics through nearest 4 local points ' Linear: linear if optional Linear argument is true ' ' Cubic spline not used due to spreadsheet macro run time issues. ' Calculation time is prohibitive if calls to such a macro were copied to a ' very large number of spreadsheet cells with potential for different table ' input on each call, because this would require solving the spline matrix ' for every call.
In this page you can download an Excel Add-in useful to linear, quadratic and cubical interpolation and extrapolation. The functions of this Add-in are very simple to. C: Program files Microsoft Office OFFICE15 Library (You can see the correct path in 'Trusted Locations' of 'Trust Center'). But, previously you have to change. Dec 2, 2009 - 4 min - Uploaded by roberto ribas2 more Lagrange type of problems performed on excel, using solver.
A simple average of the two possible quadratics through ' the nearest 4 local points (excepting single quadratic for end intervals) ' is nearly as good (i.e., cubic for equal spaced interior points), without ' this run time penalty.