Plot 2 curves in a 3D space at a different angle

Hello, I want to plot 2 curves in a 3D space, one which is at an angle of 0 degrees, and the other at an angle of 47 degrees, both starting and ending in the same points. Here is a sketch of roughly what I am trying to implement.
As a note, 2 out of 3 axes have the same values (the 2 graphs should be identical in 2D space), the only one that is different is the one where I would change the angle.

 Accepted Answer

Experiment with this:
t = linspace(0, 1);
x = cos(pi*t);
y = sin(pi*t);
a = [sind(0); sind(47)]; % Z-Angles
figure
plot3(x, -y, a(2)*y, 'LineWidth',2)
hold on
plot3(x, -y, a(1)*y, 'LineWidth',2)
hold off
grid
axis([-1.5 1 -1.5 1 0 1])
view(100,30)
producing:
EDIT — (29 Jan 2021 at 16:21)
A slightly different version —
t = linspace(0, 1);
x = cos(pi*t);
y = sin(pi*t);
a1 = [sind(0); sind(47)]; % Z-Angles
a2 = [cosd(0); cosd(47)]; % Y-Angles
figure
plot3(x+1, -y*a2(2), a1(2)*y, 'LineWidth',2)
hold on
plot3(x+1, -y*a2(1), a1(1)*y, 'LineWidth',2)
plot3([0 2], [0 0], [0 0], '-k', 'LineWidth',2)
plot3([0 0], [0 0], [0 2], '-k', 'LineWidth',2)
plot3([0 0], [0 2], [0 0], '-k', 'LineWidth',2)
hold off
grid
axis([0 2 -1 1 0 1])
view(100,30)
producing:
The code is essentially the same. It scales the ‘y’ vector differently in the plot.
.

2 Comments

Yep, it works perfectly! Thank you!
As always, my pleasure!
This was interesting!

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Release

R2020a

Asked:

on 29 Jan 2021

Commented:

on 29 Jan 2021

Community Treasure Hunt

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

Start Hunting!