Форум для обсуждения курса

24.02.2024 МТ-401

24.02.2024 МТ-401

Артем Маковецкий -
回帖数:0

points = [
1 1; #I
1 5;
3 1;
4 4;

-1 1; #II
-1 5;
-4 1;
-5 5;

-1 -1; #III
-1 -3;
-4 -1;
-4 -2;

1 -1; #IV
4 -1;
1 -5;
3 -5;
];

hold on;

X = -10 : 0.01 : 10;
Y = -10 : 0.01 : 10;

plot(X, 0, 'k');
plot(0, Y, 'k');

for i = 1 : size(points)(1)
if points(i, 1) > 0 && points(i, 2) > 0
plot(points(i, 1), points(i, 2), 'r*');
elseif points(i, 1) > 0 && points(i, 2) < 0
plot(points(i, 1), points(i, 2), 'b*');
elseif points(i, 1) < 0 && points(i, 2) < 0
plot(points(i, 1), points(i, 2), 'g*');
else
plot(points(i, 1), points(i, 2), 'm*');
endif
endfor

hold off;