MATLAB: How to plot a 3d graph with projection of 3d axis values on to the 2d surface with vertical lines 3d plotsMATLABplot Hi guys, Can any one help me out in plotting a 3d graph with projection of 3d axis values on to the 2d surface with vertical lines. Example image is attached. Let me know If there is any simple solution for this Best Answer N = 100 ;x = rand(N,1) ; y = rand(N,1) ; z = rand(N,1) ;% pick some points from above to draw vertical linesidx = randperm(N,10) ; x1 = x(idx) ; y1 = y(idx) ; z1 = z(idx) ; x2 = x(idx) ; y2 = y(idx) ; z2 = 0*z(idx) ; % draw vertical lines plot3(x,y,z,'ob')hold onplot3([x1 x2]',[y1 y2]',[z1 z2]','r') Related SolutionsMATLAB: Plotting a rectangle in 3D space plot3d( [x1 x2 x3 x4 x1], [y1 y2 y3 y4 y1], [z z z z z] )If, that is, you want it as a line. If you want it as a surface, use patch() instead of plot3d() MATLAB: How to calculate the diameter of 3D Gaussian normal distribution Let X, Y,Z be your matrices. val = 0.5 ; % at this z-value I want radius / diameter idx = abs(Z-val) < 10^-3 ; x = X(idx) ; y = Y(idx) ; z = Z(idx) ; C = [mean(x) mean(y)] ; % Center of circle dx = C(1)-x ; dy = C(2)-y ; R = sqrt(dx.^2) ;D = 2*mean(R);Also you can try fitting a circle with the obtained (x,y) using https://in.mathworks.com/matlabcentral/fileexchange/5557-circle-fit Related Question3D Surface plot using truncated set of data2D density plot with colorbar
Best Answer