%discriminationdemo.m
%Type 1 
xp=-4:0.1:4; 
y1p=-5*xp+3;
y2p=2*xp-3; 
y3p=-3*xp+4; 
DATA=[];
for i=1:1:200 
    x=rand*8-4; 
    y=rand*140-60; 
    DATA=[DATA;x y]; 
end
figure(1) 
plot(xp,y1p,'r-')
hold on 
plot(xp,y2p,'b-') 
plot(xp,y3p,'k-')
plotdata(DATA,5,1,-3,1,'r*')
plotdata(DATA,-2,1,3,1,'bd') 
plotdata(DATA,-3,-1,4,1,'ko') 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
xp=-4:0.1:4; 
z1p=9*xp-9;
z2p=-13*xp+18;
z3p=-2*xp+4.5;
figure(2) 
plot(xp,z1p,'r-')
hold on 
plot(xp,z2p,'b-') 
plot(xp,z3p,'k-') 
plotdata(DATA,-9,1,9,2,'r*') 
plotdata(DATA,13,1,-18,2,'bd') 
plotdata(DATA,-2,-1,4.5,2,'ko') 

