how to obtain volume data from X,Y,Z,c data to use slice() function?

조회 수: 5 (최근 30일)
If we have X,Y,Z,v data, how can I manage to get Volume data form in order to use slice function?
please check data (data.mat)
first column: x coordinate
second column: y coordinate
third column: z coordinate
fourth column: data
  댓글 수: 2
Philippe Corner
Philippe Corner 2020년 1월 18일
Yes, thank you walter.
Im not sure how to mesh this data to obtain the solid rectangle I need..
my code goes like this:
load('data.mat')
x = data(:,1);
y = data(:,2);
z = data(:,3);
c = data(:,4);
F = scatteredInterpolant(x,y,z,c);
[xq,yq,zq] = meshgrid(-10:1:20); %im not sure how to build it
vq = F(xq,yq,zq);
xslice = [0];
yslice = [0];
zslice = [0];
slice(xq,yq,zq,vq,xslice,yslice,zslice)
I'm suposed to obtain a solid rectangle among this scatter:
scatter3(x,y,z,4,'filled')
something like:
plot.pngWhat I really want is to obtain a meshgrid and plot a 3d voxel that represents my initial data among:
limx = [(592447.8 592463.9)]
limy = [(507793.3 507837.4)]
limz = [(2553.6 2559.9)]
any suggestion walter?
thanks in advance!

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 1월 18일
편집: Walter Roberson 2020년 1월 18일
N = 50;
xvec = linspace(592447.8, 592463.9, N);
yvec = linspace(507793.3, 507837.4, N);
zvec = linspace(2553.6, 2559.9, N);
[xq, yq, zq] = meshgrid(xvec, yvec, zvec);
load('data.mat')
x = data(:,1);
y = data(:,2);
z = data(:,3);
c = data(:,4);
F = scatteredInterpolant(x,y,z,c);
vq = F(X, Y, Z);
xslice = something in the x range;
yslice = something in the y range;
zslice = something in the z range;
slice(xq, yq, zq, vq, xslice, yslice, zslice)
  댓글 수: 2
Philippe Corner
Philippe Corner 2020년 1월 18일
vq = F(xq, yq, zq); %i think this line would be like this.
thanks a lot Walter, this was very helpful!
Walter Roberson
Walter Roberson 2020년 1월 18일
Sorry, yes, I renamed variables as I posted and missed renaming that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by