PDA

View Full Version : interpolation



amrane
06-23-2015, 05:22 AM
Dear Forum,
I am looking to make interpolation way to expand original scanned curve+digitalised over step of 1 in the "x" axe, so thank you sir to support me to fulfill the column"F".

over this forum, I tested macro from this forum discussion "InterpolationData_Example.xlsm", but its not accurate at all,!!

looking for your advice, thank you in advance
Br,
Amrane

Kenneth Hobs
06-23-2015, 08:02 AM
The thread you referenced was: http://www.vbaexpress.com/forum/showthread.php?46024-Solved-Interpolation-function-with-empty-data

Try changing the scale to be the same so that you can compare apples to apples.

I know of some polynominal fits we could try if the scale deal doesn't pan out for you.

amrane
06-24-2015, 12:52 AM
Dear Mr Kenneth Hobs

thank you sir for your advice,
actually I was referring to the same tread, I used the function in my second sheet "=PINTERP($A$2:$A$15,$B$2:$B$15,E2)", but the result are not so good, for instance:
In the original curve the max is [14024.056 // 7.0932953: cells( 9,a & b)] no more than 10 in the vertical axe,
but
the interpolated curve it is more than 30: ie [14012 33.33822278: cells( 69,E & F)]

so the produced curve is not so accurate, , is there any way to improve?

thank you sir for you help,

Br, Amrane

Kenneth Hobs
06-24-2015, 02:25 PM
If you use it just for those X points, it returns the same Y points. If you use it for each whole number of X points, even for the same X point used earlier, it returns a slightly different Y point.

You could try a spline fit if you don't need smoothing. An addon says it can find the Y point given and X. http://www.xlxtrfun.com/XlXtrFun/XlXtrFun.htm

If you just want to try splines, see: shg's post #2 at: http://www.mrexcel.com/forum/excel-questions/718515-cubic-spline-visual-basic-applications-code.html

SHG's routine returns the X and then the Y points. After adding his routines, enter this in one cell: =CubicSpline($A$2:$B$15,1,1)
Press F2, select 28 rows in a column and press Alt+Ctrl+Enter. Again, it is very close to the original Y points. No or interpolation or extrapolation is possible. One can easily to extrapolation between two known points with the same slope though using standard routines.

amrane
06-27-2015, 06:25 AM
Dear Mr Kenneth Hobs


thank you soo much for your help, the function "interpolate" under "XlXtrFun.xll" is perfect.

Br,
Amrane