w = (l.*y)'*x; beta = -w(1)/w(2); alpha = b/w(2); hold off plot(x(:,1),alpha+beta*x(:,1),"-;;") hold on plotyx(yx) betax = strcat(num2str(beta),"*x"); com0 = strcat(num2str(alpha),"+",betax); Jplus = J0(find(y(J0)>0)); # indices of sv's with +1 Jminus = J0(find(y(J0)<0)); # indices of sv's with -1 i = Jplus(1); j = Jminus(1); xi = x(i,:); xj = x(j,:); aplus = xi(2)-beta*xi(1); com1 = strcat(num2str(aplus),"+",betax); aminus = xj(2)-beta*xj(1); com2 = strcat(num2str(aminus),"+",betax); gplot com1,com2