How to plot a rectangle from a single point ?

 Respuesta aceptada

Wan Ji
Wan Ji el 24 de Ag. de 2021
Editada: Wan Ji el 24 de Ag. de 2021
Hi,
Use rectangle function
rectangle('Position',[0,0,2,4]); % [x_left_down_corner, y_left_down_corner, length, width]
Use axis function make it look clear
axis([-1,3,-1,5])
axis equal

3 comentarios

Wan Ji
Wan Ji el 24 de Ag. de 2021
Editada: Wan Ji el 24 de Ag. de 2021
at least 4 parameters can define a rectangle.
Salem
Salem el 24 de Ag. de 2021
Thank you, I have a point named for ex. 'dot' which has x and y value. Can I recall the name of a point rather than specify in numbers again the position of the rectangle?
It is not enough to have x and y, but still length and width are required.
length = 2;
width = 4;
rectangle('Position',[ex.x, ex.y, length, width]); % [x_left_down_corner, y_left_down_corner, length, width]

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Ag. de 2021

Comentada:

el 24 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by