Linear equations in two variables

%Linear equations in two variables.

x = -2: 0.05: 6;
y1 = 2*x – 2;
subplot(2, 2, 1)
plot(x, y1), grid
title(‘a)’)
xlabel(‘x_1’), ylabel(‘x_2’)
text(x(15), y1(15), ‘2x_1 – x_2 = 2’)
y2 = -x + 5;
subplot(2, 2, 2)
plot(x, y1, x, y2), grid
title(‘b)’)
xlabel(‘x_1’), ylabel(‘x_2’)
text(x(10), y1(10), ‘2x_1 – x_2 = 2’)
text(x(10), y2(10), ‘x_1 + x_2 = 5’)
y3 = 2*x;
subplot(2, 2, 3)
plot(x, y1, x, y3), grid
title(‘c)’)
xlabel(‘x_1’), ylabel(‘x_2’)
text(x(20), y1(10), ‘2x_1 – x_2 = 2’)
text(x(25), y3(95), ‘2x_1 – x_2 = 0’)
y4 = 6*x + 5;
subplot(2, 2, 4)
axis([-2 6 -20 50])
plot(x, y1, x, y2, x, y4), grid
title(‘d)’)
xlabel(‘x_1’), ylabel(‘x_2’)
text(-1, -12, ‘2x_1 – x_2 = 2’)
text(-1.5, 11, ‘x_1 + x_2 = 5’)
text(x(60), y4(120), ‘6x_1 – x_2 = -5’)