# how can i have plot3 from different matrix

1 view (last 30 days)
sahar kheibarihafshejani on 13 Aug 2020
Edited: Ayush Gupta on 1 Sep 2020
Hello, i have have meshgrid matrix of x , y, z position of 3 different layers(9 different matrix) and now want to have a 3D plot which connect the first x,y,z, position of the first layer to the x,y,z position to te second the then third one. with find function i could find the row and culomn of desire positions now how can i define it for plot3 function?
[row col] = find(mod(nr_up,2)==1 & mod(nr_up,2)==1);
for ii = 1:length(row)
i=row(ii);
for jj=1:length(col)
j=col(jj);
xBottom=xBottomMat(i,j);
yBottom=yBottomMat(i,j);
zBottom=zBottomMat(i,j);
x_low=xl_low(i,j);
y_low=yl_low(i,j);
zLow=zLowMat(i,j);
x_up=xl_up(i,j);
y_up=yl_up(i,j);
zUp=zUpMat(i,j);
x_last=xl_last(i,j);
y_last=yl_last(i,j);
zLast=zLastMat(i,j);
x= [posSource(1),xBottom,x_low,x_up,x_last];
y=[posSource(2),yBottom,y_low,y_up,y_last];
z=[posSource(3),zBottom,zLow,zUp,zLast];
plot3(x,y,z);axis equal; hold on ;grid on;

Ayush Gupta on 1 Sep 2020
Edited: Ayush Gupta on 1 Sep 2020
To make a 3D mesh from a set of points, the generateMesh function in MATLAB can be used. To include 3-D geometry in it we can use importGeometry or geometryFromFresh. The documentation for generateMesh can be accessed from here along with a few examples on how to use it.