My line is missing and all the data are being separated.
How to rejoin to become a line?
please help me.
#No marker is required.
z = meshgrid(0:0.1:50)
x = exp(-0.03*z).* sin(z);
y = exp(-0.03*z).* cos(z);
figure
plot3(x,y,z)
xlabel('x')
ylabel('y')
zlabel('z')

 Respuesta aceptada

Star Strider
Star Strider el 30 de Nov. de 2017

1 voto

You do not need meshgrid with plot3.
This works:
z = (0:0.1:50);
x = exp(-0.03*z).* sin(z);
y = exp(-0.03*z).* cos(z);
figure
plot3(x,y,z)
xlabel('x')
ylabel('y')
zlabel('z')
grid on
and your spiral appears!

4 comentarios

Zack Kit
Zack Kit el 30 de Nov. de 2017
Editada: Zack Kit el 30 de Nov. de 2017
yeah
but my lecturer asked me to use meshgrid.
is there any other method?
Thank you.
Star Strider
Star Strider el 30 de Nov. de 2017
If you’re also constrained to using plot3, then there may not be a solution.
If you can use mesh, this works:
z = meshgrid(0:0.1:50);
x = exp(-0.03*z).* sin(z);
y = exp(-0.03*z).* cos(z);
figure
mesh(x,y,z)
xlabel('x')
ylabel('y')
zlabel('z')
grid on
Zack Kit
Zack Kit el 30 de Nov. de 2017
Editada: Zack Kit el 30 de Nov. de 2017
Thank you. I got it.
Star Strider
Star Strider el 30 de Nov. de 2017
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 30 de Nov. de 2017

Comentada:

el 30 de Nov. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by