Let’s say I have a 1D Gaussian function.
Its length is 600.
I want to interpolate it into a 2D Gaussian of the size 600 X 600.
This is the code I wrote (OTFx is the Gaussian Function, OTF – 2d Interpolated Function):
[x, y] = meshgrid([-300:299], [-300:299]);
r = sqrt((x .^ 2) + (y .^ 2));
OTF = interp1([-300:299], OTFx, r(:), 'spline');
OTF = reshape(OTF, [600, 600]);
The problem is I get Overshoot at the end:
How can I prevent this overshoot?
Is there better interpolating algorithm for monotonic descending functions?
NOTE: I am looking for a generic solution for interpolating a 1D function into a 2D radially symmetric function, the Gaussian is just an example.
EDIT: based on your clarification, it’s clear what’s going on. You are trying to interpolate a function beyond the range of available data — i.e. you are going from interpolation to extrapolation. Splines are going to result in the overshoot that you are observing. The solution is simply to make sure that your 1D function has values in the interval [min(r), max(r)]. Note that in the original data, max(r) is about 424, while the function you are interpolating is defined on the range [-300,299]
alt text http://img54.imageshack.us/img54/8255/clipboard01vz.png