Interpolation for 3D scattered data
조회 수: 3 (최근 30일)
이전 댓글 표시
a= [0 5 9 20 30 35] ; % cordinbates X
b= [0 4 27 31 35] ; % cordinbates Y
c= [1 5 6 8 10 20 ] ; % cordinbates Z
d= [40 40.1 40.2 40.4 40.1 40.1] ; % Temperature Values
[x,y,z] = meshgrid(a,b,c);
v = interp3(a,b,c,d,x,y,z);
does not work I need v to be interpolated for every 3D point (x,y,z). How can I perform? Thanks in advance
댓글 수: 0
답변 (2개)
KSSV
2017년 4월 25일
You have to make d a 3d matrix of size equal to x.
a= [0 5 9 20 30 35] ; % cordinbates X
b= [0 4 27 31 35] ; % cordinbates Y
c= [1 5 6 8 10 20 ] ; % cordinbates Z
d= [40 40.1 40.2 40.4 40.1 40.1] ; % Temperature Values
[x,y,z] = meshgrid(a,b,c);
d1 = repmat(d,size(x,1),1) ;
d2 = zeros(size(x)) ;
for i = 1:size(x,3)
d2(:,:,i) = d1 ;
end
v = interp3(a,b,c,d2,x,y,z);
댓글 수: 0
Andrei Bobrov
2017년 4월 25일
a= [0 5 9 20 30 35] ; % cordinbates X
b= [0 4 10 27 31 35] ; % cordinbates Y I'm fixed
c= [1 5 6 8 10 20 ] ; % cordinbates Z
d= [40 40.1 40.2 40.4 40.1 40.1] ; % Temperature Values
F = scatteredInterpolant(a(:),b(:),c(:),d(:));
[x,y,z] = meshgrid(a,b,c);
v = F(x,y,z);
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!