How to draw a rectangle in matlab with only his center ?

25 次查看(过去 30 天)
I would like to draw a rectangle with only one informatiom which is his center . I have the coordinates X and Y of fis Center and like to draw a rectangle with specific dimesions . I would like to know if theres a function which do it

回答(1 个)

Image Analyst
Image Analyst 2017-12-14
The rectangle function.
width = 100; % whatever
height = 50; % whatever...
xCenter = 400; % Wherever...
yCenter = 800; % Wherever...
xLeft = xCenter - width/2;
yBottom = yCenter - height/2;
rectangle('Position', [xLeft, yBottom, width, height], 'EdgeColor', 'b', 'FaceColor', 'r', 'LineWidth', 4);
xlim([340, 460]);
ylim([740, 860]);
grid on;

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by