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: N
Subject: Re: Interpolating over a non-monotonic mesh
Date: Fri, 29 May 2020 22:19:34 +0200

> 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: 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?

Had or still have close the same problem but it also have some random 
variations for grid position. griddata(...) I think interpolate from the four 
neareast neighbours feels like a good solution also for a scewed mesh. Generate 
tringulation with dealunay(...) function is another option I used there I got a 
slightly modified version of function for inerpolation on this mesh from 
someone here I can't remember the name of. There also other statistical methods 
there kriging might be a good option.


Nicklas SB Karlsson



reply via email to

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