Dear everybody,
I have a problem, I want to draw 3 line.
First line: In xy plan has to be sin(x) ;
Second line: In xz plan has to be cos(x) ;
Third line: In xyz plan has to be sin(x)+cos(x);
I have no idea for it. What is the solution?
I will appreciate your help.
Thank you.
Istvan

2 个评论

Hi @Istvan, The first curve is , and the second curve is . But I cannot visualize the third curve on the so-called "x-y-z" plane. Can you sketch it?
Istvan
Istvan 2025-2-12
编辑:Istvan 2025-2-12
It would be an elliptically polar wave. in this picture the cos and sin function are replaced, but the point is the same.

请先登录,再进行评论。

 采纳的回答

Peerhaps something like this —
t = linspace(0, 1).';
x = sin(2*pi*t);
y = cos(2*pi*t);
z = x+y;
figure
plot3(x, y, z)
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
axis('equal')
figure
stem3(x, y, z, '.')
hold on
patch(x, y, zeros(size(z)), 'g', FaceAlpha=0.5)
hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
axis('equal')
figure
patch(x, y, z, 'r', FaceAlpha=0.5)
hold on
patch(x, y, zeros(size(z)), 'g', FaceAlpha=0.5)
hold off
grid on
axis('equal')
xlabel('X')
ylabel('Y')
zlabel('Z')
view(-27, 30)
.

6 个评论

Dear Sam,
It would be an elliptically polar wave. in this picture the cos and sin function are replaced, but the point is the same.
sin(x)+cos(x) does not get you an elliptic polar wave.
Something like sin(x)+cos(y) would be closer.
Sam Chak
Sam Chak 2025-2-12
编辑:Sam Chak 2025-2-12

But sin(x) + cos(y) would give a surface. Thus, I believe Star's parameterized equations is probably the best approach to generate the helical spiral trajectory (bolded black curve) that maps out the elliptical projection on the normal plane.

I didn’t realise what you wanted.
Try this —
t = linspace(0, 4, 500).';
x = sin(2*pi*t);
y = cos(2*pi*t);
figure
patch(t, x, zeros(numel(t), 1), 'r', FaceAlpha=0.5, EdgeColor='r')
hold on
patch(t, zeros(numel(t), 1), [0; y(2:end-1); 0], 'b', FaceAlpha=0.5, EdgeColor='b')
plot3(t, x, y, 'g', LineWidth=2)
plot3(xlim, [0 0], [0 0], '-k', LineWidth=2)
plot3([0 0], ylim, [0 0], '-k', LineWidth=2)
plot3([0 0], [0 0], zlim, '-k', LineWidth=2)
hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
text(0, 0, max(zlim), 'Y', Vert='bottom', Horiz='center')
text(0, min(ylim)-0.3, 0, 'Z', Horiz='left')
text(4.1, 0, 0, 'X', Horiz='left')
view(25,20)
Ax = gca;
Ax.Visible = 'off';
axis('equal')
●
Make appropriate changes to get the result you want.
.
@Star Strider Perfect, that is exatly what i thought.
I am grateful to you.
Thank you.
Best regards.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

请先登录,再进行评论。

更多回答(0 个)

类别

产品

版本

R2024b

标签

Community Treasure Hunt

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

Start Hunting!

Translated by