how to draw multiple lines?

4 visualizaciones (últimos 30 días)
Eman S
Eman S el 4 de Ag. de 2018
Editada: Eman S el 2 de Feb. de 2020
Hi all, how to draw multiple lines that have (start point (0,0) with different angles 0:5:90 degrees)?? any suggestions for code??
  1 comentario
Image Analyst
Image Analyst el 1 de Feb. de 2020
Original question
how to draw multiple lines that have (start point (0,0) with different angles 0:5:90) ??
Hi all, how to draw multiple lines that have (start point (0,0) with different angles 0:5:90 degrees)?? any suggestions for code??

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 4 de Ag. de 2018
Try this:
deg = 0 : 5 : 90;
r = 1;
x = r*[zeros(size(deg(:))) cosd(deg(:))];
y = r*[zeros(size(deg(:))) sind(deg(:))];
figure
plot(x', y', 'LineWidth',2)
axis equal
Here, ‘r’ (the radius value) defines the end points for each line. If you want different lengths for each line, ‘r’ becomes a (19x1) vector with a different value assigned to each element.
  2 comentarios
Eman S
Eman S el 4 de Ag. de 2018
Thanks. It worked.
Star Strider
Star Strider el 4 de Ag. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (1)

Rohit Rao
Rohit Rao el 4 de Ag. de 2018
Have you tried running the plot command inside a loop ?!

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by