Search code examples
matlabhelix

Helix Axis of rotation in matlab


Ingeneral we create a helix using below code

t = 0:pi/50:20*pi;
st = sin(t);
ct = cos(t);
plot3(st,ct,t)

Using this code, a helix is generated. Can you tell me if there is any command though which I can see the axis of rotation as shown in below figure??

enter image description here


Solution

  • As the axis of rotation is parallel to the z-axis, you can simply draw a line there:

    hold on %# do not erase other plot
    plot([0;0],[0;0],[t(1);t(end)],'k')