Clear Filters
Clear Filters

How to create a cuboid by connecting points through scatter3 plot?

2 views (last 30 days)
Hi All,
I am following the approach to draw the cuboid by plotting the coordinates of the vertices through scatter plot; scatter3 and connecting the vertices through lines.
Here's my code; (I'm getting just discrete points from it but I want connections between points too)
Aa=30; Bb=30; Cc=30;
na=5; nb=5; nc=5;
lx=linspace(0,Aa,na);
ly=linspace(0,Bb,nb);
lz=linspace(0,Cc,nc);
scatter3(0,0,0,'r')
hold on
scatter3(1,0,0,'r')
hold on
scatter3(1,1,0,'r')
hold on
scatter3(0,1,0,'r')
hold on
scatter3(0,1,1,'r')
hold on
scatter3(0,0,1,'r')
hold on
scatter3(1,0,1,'r')
hold on
scatter3(1,1,1,'r')
hold on
figure;
line(lx,ly,lz)
can some one suggest how to do it?
Thanks in advance!
Regards
Swati

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!