# Add 2d plots along a 3d helix

7 views (last 30 days)
Vivi on 13 Feb 2020
Commented: Subhadeep Koley on 14 Sep 2020
Hello.
I have a simple helix that I've plotted by using the following code:
r=93.36;
theta=0:pi/50:10*pi;
%Trajectory in x-direction
x=-r.*cos(theta);
%Trajectory in y-direction
y=r.*sin(theta);
%Trajectory in z-direction
z=theta;
figure(1);
plot3(x,y,z);
xlabel('x');
ylabel('y');
zlabel('z');
grid on
My goal now is to also plot on the same graph the x and y components of the helix given from the equations above.
Thank you.

Subhadeep Koley on 13 Feb 2020
Use this
close all; clc;
r=93.36;
theta=0:pi/50:10*pi;
%Trajectory in x-direction
x=-r.*cos(theta);
%Trajectory in y-direction
y=r.*sin(theta);
%Trajectory in z-direction
z=theta;
figure(1);
plot3(x,y,z);
xlabel('x');
ylabel('y');
zlabel('z');
grid on
hold on;
plot(x, y, 'r', 'LineWidth', 3);
Subhadeep Koley on 14 Sep 2020
Refer to the below link for a detailed explanation.
https://www.mathworks.com/help/matlab/ref/colon.html#bvhfyce