interp3 function returns NaN
7 views (last 30 days)
Show older comments
I have a parameter called Cm that I need to interpolate in 3D between the points defined by the following specific coordinates:
x=[4 5 6];
y=[0.55 0.7];
z=[40 80];
the values of the Cm at these specific points are as follows:
Cm(1,1,1)= 2.5;
Cm(2,1,1)=3;
Cm(3,1,1)=4;
Cm(1,2,1)= 2.8;
Cm(2,2,1)=3.5;
Cm(3,2,1)=4.5;
Cm(1,1,2)= 1.5;
Cm(2,1,2)=1.8;
Cm(3,1,2)=2;
Cm(1,2,2)= 1.8;
Cm(2,2,2)=2.2;
Cm(3,2,2)=2.8;
when I use iterp3 as shown below:
interp3(Cm,0.65,4.5,50)
it returns NaN. the Xq, Yq, Zq are all inside the x,y, and z intervals. could you let me know why is this not working?
thanks
Matt
0 Comments
Answers (1)
Walter Roberson
on 31 Dec 2013
Vq = interp3(V,Xq,Yq,Zq) assumes a default grid of sample points. The default grid points cover the region, X=1:n, Y=1:m, Z=1:p, where [m,n,p] = size(V).
Notice the "default grid". 0.65 is less than 1 and so must be outside the default grid.
0 Comments
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!