interp3 function returns NaN

조회 수: 7 (최근 30일)
Matt Badaye
Matt Badaye 2013년 12월 31일
답변: Walter Roberson 2013년 12월 31일
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

답변 (1개)

Walter Roberson
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.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by