The code behind rectangular command

clear all
close all
clc
a = input('Dim 1: '); % Width for ex: Dim 1: 5(cm)
b = input('Dim 2: '); % Length for ex: Dim 2: 10(cm)
width = a;
length = b;
x_center = 0; % x of the center of the rectangle
y_center = 0; % y of the center of the rectangle
xl = x_center - width/2;
yb = y_center - length/2;
rectangle('Position',[xl, yb, width, length]) % I have to eliminate this line and reformulate it without using "rectangle" command
grid on
xlim([-100, 100]);
ylim([-100, 100]);
xL = xlim;
yL = ylim;
line([0 0], yL)
line(xL, [0 0])
Can anyone tell me what code stands for the rectangular command? I need to know so that I can use it to eliminate the actual command in the code above. I really need help with this.
Thank you!

回答 (1 件)

the cyclist
the cyclist 2020 年 4 月 7 日
編集済み: the cyclist 2020 年 4 月 7 日

0 投票

It's doing what is described in the documentation for the rectangle function.
Hint: There is a line function in MATLAB.

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2020 年 4 月 7 日

編集済み:

2020 年 4 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by