octave - Using interp3 in matlab -


I am trying to understand how to use the 3D matlab interpolation function interp3 I have tried different options but it continues the errors. I have 3 arrays in which V :

  X = ndgrid (-246.4529: 2.5: -246.4529 + 100 * 2.5 - 1) are coordinates; Y = ndgrid (-45.6577: 2.5: -45.6577 + 213 * 2.5 - 1); Z = ndgrid (-211.00: 2.5: -211.00 + 140 * 2.5 - 1);  

And with coordinates, the other 3 arrays where I want to interrupt each other:

  Xp = ndgrid (-255.21: 5: -255.21) + 50 * 5 - 1); Yp = ndgrid (-50.66: 5: -50.66 + 108 * 5 - 1); Zp = ndgrid (-215.00: 5: -215.00 + 86 * 5 - 1);  

And then I got V , which is a sample value vector, which is specified as a vector, which defines the value on the sample points Does.

npoints = 100 * 213 * 140; For N = 1: npoints i = rem (N-1, dim (1)) + 1; P (n, 1) = x (i); J = rem (fixed ((n-i) / dim (1)), dim (2)) + 1; P (N, 2) = Y (J); Kashmir = roof (N / (dim (1) * dim (2))); P (N, 3) = Z (K); Store Sample V (N, 1) = Mat (i, j, k); End

I now use VP :

  Vq = interp3 to get the  V  X, Y, Z, V, XP, YP, JP)  

But I have found:

  Error grid vectors not using griddinolent Define the grid of the points matched with the given values. Error in the interpip (line 130) F = Confused interpolent ({x, y, z}, v, method, extrap);  

How can I use interp3 with my data?

Interpol works with MeshGrid ndgrid ...

Personnaly, as I always get confused when trying to understand the mixed orientation of the grid vectors with ' meshgrid ** And it gives the size of arrays **, I like working with interpn which works from ndgrid

 % input grid x = (-246.4529: 2.5: -246.4529 + 100 * 2.5 - 1); Y = -45.6577: 2.5: -45.6577 + 213 * 2.5 - 1; Z = -211.00: 2.5: -211.00 + 140 * 2.5 - 1; % Output Grid xp = -255.21: 5: -255.21 + 50 * 5 - 1; Yp = -50.66: 5: -50.66 + 108 * 5 - 1; Zp = -215.00: 5: -215.00 + 86 * 5 - 1; % Data V = randn (length (x), length (y), length (z));  

then using interpn and ndgrid :

 % Interpolation [X, Y, Z] = Ndgrid (x, y, z); [XP, YP, JP] = ndgrid (xp, yp, zp); Vq = InterPanel (X, Y, Z, V, XP, YP, JP);  

**: I think the meshgrid always triggers the first two dimensions


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -