help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpolating over a non-monotonic mesh


From: Brett Green
Subject: Re: Interpolating over a non-monotonic mesh
Date: Fri, 29 May 2020 12:41:50 -0400

For the sake of others who may have the same question, I should specify the solutions mentioned earlier. I was referring to griddata. For now I will be trying that, but I would certainly be interested to hear if others have ideas.

- Brett Green


On Fri, May 29, 2020 at 12:37 PM Brett Green <green.brett.r@gmail.com> wrote:
I use the following code to generate a 2D parallelogram-shaped mesh:

xmax = 4;
ymax = 3;
xres = 7;
yres = 5;

m = sqrt(3); % Slope of tilted side; slope = Inf for a rectangle
xmax_adjusted = xmax*(1-1/xres);
ymax_adjusted = ymax*(1-1/yres);
x = (linspace(-xmax_adjusted,xmax_adjusted,xres).').*ones(1,yres);
y = linspace(-ymax_adjusted,ymax_adjusted,yres).*ones(xres,1) + (1/m).*x;

% Plot to check lattice:
clf
hold on
mksz = 20;
plot(x,y,"linestyle","none","marker",".","markersize",mksz,"color","b")
axis equal

It produces meshes like this:
image.png

I would like to evaluate a function at each of these points and then interpolate its values to a finer mesh. The finer mesh should also be a parallelogram of the form depicted above, just with more points. Unfortunately, because the meshes x and y are not both monotonic, I cannot use interp2 here.

I'm aware of solutions in which the parallelogram grid is used to create a rectangular grid, which can then be interpolated, but if possible I would like to interpolate without using another lattice. Is anyone aware of a method to do this?

- Brett Green

reply via email to

[Prev in Thread] Current Thread [Next in Thread]