# 3d Plots in Matlab

Description
Description of how to plot 3d graphs in Matlab
Categories
Published

View again

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
3D plots in Matlab How to plot a point plot3(x,y,z), where x,y,z are the coordinates of the point Example: x1=2; y1=1; z1=-1; x2=2; y2=2; z2=0; x3=1; y3=3; z3=1; figure(1) plot3(x1,y1,z1,'ro',x2,y2,z2,'b*',x3,y3,z3,'ks','linewidth',2) xlabel('axis x') ylabel('axis y') zlabel('axis z') grid 11.52123-1-0.500.51   a  x   i  s  z axis xaxis y  How to plot a segment plot3(x,y,z), where x,y,z are vectors of the coordinates of the initial and final points of the vector Example: x1=2; y1=1; z1=-1; x2=2; y2=2; z2=0; x3=1; y3=3; z3=1; %segment 12 x12=[x1 x2]; y12=[y1 y2]; z12=[z1 z2]; %segment 13 x13=[x1 x3]; y13=[y1 y3]; z13=[z1 z3]; %segment 23 x23=[x2 x3]; y23=[y2 y3]; z23=[z2 z3]; figure(1) plot3(x12,y12,z12,'g-',x13,y13,z13,'m-',x23,y23,z23,'c- ','linewidth',2) xlabel('axis x') ylabel('axis y') zlabel('axis z') grid 11.52123-1-0.500.51axis xaxis y   a  x   i  s   z  How to plot a line plot3(x,y,z), where x,y,z are vectors of the coordinates of the points of the line Example: %vector of coordinates x x=[0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0]; %vector of coordinates y y=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1]; %vector of coordinates z z=linspace(0,2,24); figure(1) plot3(x,y,z,'linewidth',2) xlabel('axis x') ylabel('axis y') zlabel('axis z') grid 00.5100.5100.511.52axis xaxis y   a  x   i  s   z  How to plot a filled polygon fill3(x,y,z), where x,y,z are vectors of the coordinates of the vertexes of the polygon Example: x1=2; y1=1; z1=-1; x2=2; y2=2; z2=0; x3=1; y3=3; z3=1; %vectors x,y,z of the vertexes of the polygon x=[x1 x2 x3]; y=[y1 y2 y3]; z=[z1 z2 z3]; figure(1) fill3(x,y,z,'b') xlabel('axis x') ylabel('axis y') zlabel('axis z') grid 11.52123-1-0.500.51axis xaxis y   a  x   i  s   z

Jul 23, 2017

#### EXP3-Class a Power Amplifier - 2013_14

Jul 23, 2017
Search
Similar documents

View more...
Tags

Related Search