Interpolation for 3D scattered data

3 次查看(过去 30 天)
Az
Az 2017-4-25
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

回答(2 个)

KSSV
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);

Andrei Bobrov
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);

类别

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