7 views (last 30 days)

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 13 Feb 2020

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;

plot3(x, y, z, 'b');

xlabel('x');

ylabel('y');

zlabel('z');

grid on; box on;

hold on;

% Plot x against theta

axis([-101 101 -101 101 -1 36]);

SX = size(x);

Y3 = 101 * ones(SX);

plot3(x, Y3, z, 'r', 'LineWidth', 1.5);

% Plot y against theta

SY = size(y);

X3 = 101 * ones(SY);

plot3(X3, y, z, 'g', 'LineWidth', 1.5);

hold off;

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.