I created a helix truncated pyramid. Though the helix has some gap on one of the corners of the pyramid. so how to fix it.i attached the cods I used.Thank you!untitled.jpg

 Accepted Answer

Adam Danz
Adam Danz on 9 Dec 2018
A line will be drawn for each column of Tx, Ty and Tz. If you remove the 'b' color definition from your call to plot3(), each line will have its own color and this will be easier to explain.
plot3(Tx,Ty,Tz)
xlabel('x')
ylabel('y')
zlabel('z')
view(0, 90)
181208 185037-Figure 1.jpg
From this view (above), the z axis is collapsed and you can see consentric rectangles. This makes sense because the first and last rows of Tx and Ty contain the same coordinates which is why the rectangles appear to be complete and continuous.
However, the story changes when we rotate the plot to make the z axis visible.
view(-29.6, 0.4)
181208 185319-Figure 1.jpg
Now we see a spiral which isn't a surprise since your z-variable (Tz) wraps the end of each rectanlge to the start of the next rectangle (actually, now we see they are no longer rectanlges). For example, the end of column 1 in Tz is -5 and the start of column 2 in Tz is -5. Nevertheless, the x and y coordinates that define the start of one rectangle and end of the previous rectangle differ (as seen in the first figure above).
That's why at some viewing angles (such as view(-44, 42.8) or (0, 90)), you can see the discontinuity between the rectangluar layers.
If you want the columns of coordinates to produce a continuous spiral, you'll need to change the Tx and Ty variables and I suggest working from the view(0, 90) since your Tz variable is already correctly wrapping to the next level.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 8 Dec 2018

Commented:

on 10 Dec 2018

Community Treasure Hunt

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

Start Hunting!