How to Plot 3 Lines
Contents
Consider the following linear system
disp('x + 2y = 1') disp('2x + y = 2') disp('3x - 3y = 3')
x + 2y = 1 2x + y = 2 3x - 3y = 3
Define a range of x values
x = -10:10;
Solve for
y1 = -.5*x + .5; y2 = -2*x + 2; y3 = 3*x - 3;
Plot the three lines in three colors
plot(x,y1,'r',x,y2,'b',x,y3,'g')
