a = 150;
b = 75;

vertices = [
    -a, -b;
    -a,  b;
     a,  b;
     a, -b
];

edges = [
    1, 2;
    2, 3;
    3, 4;
    4, 1
];

figure;
hold on;
for i = 1:size(edges, 1)
    v1 = vertices(edges(i, 1), :);
    v2 = vertices(edges(i, 2), :);
    plot([v1(1), v2(1)], [v1(2), v2(2)], 'r-', 'LineWidth', 2);
end

axis equal;
%grid on;
xlabel('x');
ylabel('y');
title('Rectangle using vertices');

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: