Asked by AP
on 2 Jan 2013

Dear All,

I am trying to use interp3 for my data which can be found at http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid:73338. The file is about 7MB. The data is distributed over an ordered Cartesian grid with uniform intervals. I can successfully use stream3 by adjusting the data for meshgrid compatibility according to the following code using permute function. It works fine. However, when I want to do interpolation, I get an error which says the input data is not a valid meshgrid.

x = permute(x , [2 1 3]); y = permute(y , [2 1 3]); z = permute(z , [2 1 3]); u = permute(u , [2 1 3]); v = permute(v , [2 1 3]); w = permute(w , [2 1 3]); InOut = permute(InOut , [2 1 3]); [ sx, sy, sz ] = meshgrid( -1:1:1, -1:1:1, -1:1:1 ); vertices = stream3( x, y, z, u, v, w, sx(:), sy(:), sz(:) ); val = interp3( x, y, z, InOut, 0, 0, 0 );

The above code stops at the line where I do the interpolation. Could someone help me?

Thanks, Ahmad

*No products are associated with this question.*

Answer by Walter Roberson
on 2 Jan 2013

Although error messages from the interp functions complain about needing meshgrid format, I find that in practice it is ndgrid() format that they need.

Opportunities for recent engineering grads.

## 0 Comments