interp3 function returns NaN
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2013년 12월 31일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!