From: Royi Avital on
Hello.
I have a 1D function which I want to interpolate into 2D function.
I know the function should have "Polar Symmetry".
Hence I use the following code:
Assuming the 1D function is LSF of the length 15.

[x, y] = meshgrid([-7:7]);
r = sqrt(x.^2 + y.^2);
PSF = interp1([-7:7], LSF, r(:)); % Sometimes using 'spline' option, same results.

PSF = reshape(PSF, [7, 7]);

I have few problems:
1. Got some overshoot at the edges.
2. Can't enforce some assumptions (Monotonic, Non Negative).

Is there a better Interpolation method for those circumstances?
I couldn't find "Lanczos" based interpolation I can use the same way as interp1 (For a certain vector of points, in "imresize" you can only set the length). Is there such function anywhere?
Has anyone encountered a function which allows enforcing some assumptions (Monotonically Decreasing, Non Negative, etc..).
Thanks.
From: Matt J on
"Royi Avital" <RoyiREMOVEAvital(a)yahoo.com> wrote in message <hoot0q$4bp$1(a)fred.mathworks.com>...
> Hello.
> I have a 1D function which I want to interpolate into 2D function.
> I know the function should have "Polar Symmetry".
> Hence I use the following code:
> Assuming the 1D function is LSF of the length 15.
>
> [x, y] = meshgrid([-7:7]);
> r = sqrt(x.^2 + y.^2);
> PSF = interp1([-7:7], LSF, r(:)); % Sometimes using 'spline' option, same results.
>
> PSF = reshape(PSF, [7, 7]);
>
> I have few problems:
> 1. Got some overshoot at the edges.
> 2. Can't enforce some assumptions (Monotonic, Non Negative).
================

Linear interpolation should satisfy all these properties.
From: Bruno Luong on
"Royi Avital" <RoyiREMOVEAvital(a)yahoo.com> wrote in message <hoot0q$4bp$1(a)fred.mathworks.com>...
> Hello.
> I have a 1D function which I want to interpolate into 2D function.
> I know the function should have "Polar Symmetry".
> Hence I use the following code:
> Assuming the 1D function is LSF of the length 15.
>
> [x, y] = meshgrid([-7:7]);
> r = sqrt(x.^2 + y.^2);
> PSF = interp1([-7:7], LSF, r(:)); % Sometimes using 'spline' option, same results.
>
> PSF = reshape(PSF, [7, 7]);
>
> I have few problems:
> 1. Got some overshoot at the edges.
> 2. Can't enforce some assumptions (Monotonic, Non Negative).
>
> Is there a better Interpolation method for those circumstances?

Perhaps John's SLM
http://www.mathworks.com/matlabcentral/fileexchange/24443-slm-shape-language-modeling

Bruno
From: Royi Avital on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hop5s0$a8j$1(a)fred.mathworks.com>...
> "Royi Avital" <RoyiREMOVEAvital(a)yahoo.com> wrote in message <hoot0q$4bp$1(a)fred.mathworks.com>...
> > Hello.
> > I have a 1D function which I want to interpolate into 2D function.
> > I know the function should have "Polar Symmetry".
> > Hence I use the following code:
> > Assuming the 1D function is LSF of the length 15.
> >
> > [x, y] = meshgrid([-7:7]);
> > r = sqrt(x.^2 + y.^2);
> > PSF = interp1([-7:7], LSF, r(:)); % Sometimes using 'spline' option, same results.
> >
> > PSF = reshape(PSF, [7, 7]);
> >
> > I have few problems:
> > 1. Got some overshoot at the edges.
> > 2. Can't enforce some assumptions (Monotonic, Non Negative).
> ================
>
> Linear interpolation should satisfy all these properties.

No it doesn't.
I'll show you.

Let's create a 2d Gaussian Kernel:
h = fspecial('gauss', 15, 3);

Now let's take a 1D profile of it:
LSF = h(8, :);

Let's apply the linear algorithms:

[x, y] = meshgrid([-7:7]);
r = sqrt(x.^2 + y.^2);
PSF = interp1([-7:7], LSF, r(:));
PSF = reshape(PSF, [7, 7]);

The results (Added "Spline" and 'Pchip"):
http://i43.tinypic.com/auxyxi.png

As you can see at the edges there's "Overshoot" (Especially in "Spline"). The linear method gets negative values and changes the form.

Thanks.
From: Royi Avital on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hopif2$fpa$1(a)fred.mathworks.com>...
> "Royi Avital" <RoyiREMOVEAvital(a)yahoo.com> wrote in message <hoot0q$4bp$1(a)fred.mathworks.com>...
> > Hello.
> > I have a 1D function which I want to interpolate into 2D function.
> > I know the function should have "Polar Symmetry".
> > Hence I use the following code:
> > Assuming the 1D function is LSF of the length 15.
> >
> > [x, y] = meshgrid([-7:7]);
> > r = sqrt(x.^2 + y.^2);
> > PSF = interp1([-7:7], LSF, r(:)); % Sometimes using 'spline' option, same results.
> >
> > PSF = reshape(PSF, [7, 7]);
> >
> > I have few problems:
> > 1. Got some overshoot at the edges.
> > 2. Can't enforce some assumptions (Monotonic, Non Negative).
> >
> > Is there a better Interpolation method for those circumstances?
>
> Perhaps John's SLM
> http://www.mathworks.com/matlabcentral/fileexchange/24443-slm-shape-language-modeling
>
> Bruno
It seems great but one thing, it seems to fit a plot to random points not to interpolate and extrapolate.
Is there an option using is the same way I use interp1?

Thanks.