MATLAB: Plotting a rectangle in 3D space 3d plotsplot Hi, Suppose I have four points as p1 = [x1,y1,z];p2 = [x2,y2,z];p3 = [x3,y3,z];p4 = [x4,y4,z]; If these four points form a perfect rectangle,what line of code should I write to plot this rectangle in 3D space? Thanks. Karthik Best Answer 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() Related SolutionsMATLAB: How do i plot x^2 +4y^2 +9z^2 = 1 fimplicit3(@(x,y,z) x.^2 +4*y.^2 +9*z.^2 - 1) MATLAB: How to write an expression like this question in matlab codes and execute it without errors but logical answers Try the following scriptclose allclearvarssyms x y zz=-(x^2)/4 - (y^2)/9 +1fsurf(z); xlabel('x'); ylabel('y'); zlabel('z');vol= int( int(z, x, -1, 1 ) , y, -2, 2)If you run it, it would give something like this: Related QuestionDerivative of a functionWay to plot multiple lines in 3d specifying start and end pointHow to plot a quadrangle
Best Answer