MATLAB Answers

0

how to fix the gap?

Asked by adam adam on 8 Dec 2018 at 21:11
Latest activity Commented on by adam adam on 10 Dec 2018 at 17:06
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Adam Danz
on 9 Dec 2018 at 0:03
 Accepted Answer

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.

  1 Comment

adam adam on 10 Dec 2018 at 17:06
Thank You!

Sign in to comment.