3D interpolation method or code or help with algorithm

Hi again guys, so Im working the the flow model available in matlab and have been following this tutorial http://www.mathworks.com/help/techdoc/visualize/f5-3558.html. If I have a 3d volume how do I interpolate the values of function y at any arbitrary 3d point please do not just say interp3 and meshgrid unless you can explain how to use them with examples in detail, I looked those up but did not understand them very well. I am new to MatLab.
The example above uses the slice function which according to MatLab also uses interpolation of the height to assign a colour value. I was also wondering if there was a way in which I could see how it assigned the colour value so as to figure out the interpolated value of the function V.
Thanks

6 Comments

Well what do you have written that isn't working? Have you looked at triscatteredinterp?
aside from the code given in the model the only line i have added is
vi= interp3 (x,y,z,v,xd,yd,zd);
to see the outputs however the outputs do not make sense and are a 2d array with NaN in some of the first and last columns.
The output of interp3 will be the same size and shape as the xd, yd, and zd inputs. If xd, yd, and zd were 2D arrays, then vi will be a 2D array. If you want vi to be a different size (perhaps a 3D array or a scalar), then you need to change your xd, yd, and zd.
Ok, here's what the model is doing. There is a 3 variable function flow in MatLab, V, with variables x,y,z. I want to interpolate the value of V along a plane that passes through the origin of x,y,z along any vector of my choice. What the example model does is it creates an x,y plane object using surf and the linspace command and creates 100 points along the x and y directions, it then rotates this plane to any degree around a given vector using the rotate command and then uses the slice command to to cut along the x,y,z coordinates of the determined plane and then deletes the plane. THIS IS WHERE THE PROBLEM COMES IN, when it uses the slice command MATLAB SAYS "The color at each point will be determined by 3-D interpolation into the volume V"; it however does not give me the value of V at those points along that plane. I want to know how I can retrieve those points using this method, interp3 or any other method you guys can suggest.
Thank you
Can you explain why you think the values returned by interp3 are wrong? Yes, there could be some NaNs because of artifacts of interpolating near the edge of the data set, but that does not mean the answer is wrong.
oh ok that makes sense thanks, i did some calculations by hand and the results of vi are similar to what i get when i put in xd,yd,and zd values in the flow function, meaning interp worked! NaN threw me off thanks!

Sign in to comment.

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Asked:

on 20 Sep 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!