X1=0.6*randn(2,300)+repmat([2;2],1,300); X2=0.6*randn(2,300)+repmat([1;-2],1,300); X=[X1 X2]; X(3,:)=ones(1,600); Y=[repmat([1;0],1,300) repmat([0;1],1,300)]; C=Y/X; %Plotting routines: plot(X1(1,:),X1(2,:),'o',X2(1,:),X2(2,:),'x'); hold on n1=min(X(1,:));n2=max(X(1,:)); t=linspace(n1,n2); L1=(-C(1,1)*t+(-C(1,3)+0.5))./C(1,2); L2=(-C(2,1)*t+(-C(2,3)+0.5))./C(2,2); plot(t,L1,t,L2);