我正在尝试制作最小距离分类器,我需要画一条线的垂直平分线来绘制决策边界。我有一个点,甚至是平分线的斜率。如何在图表上绘制它?
答案 0 :(得分:0)
以下函数将绘制一条给定中心点和斜率的线:
function drawLine(point,slope)
% point - vector [x,y]
% slope - slope of the line
x = point(1);
y = point(2);
lengthLine = 5;
xLine = x-lengthLine:x+lengthLine;
yLine = slope*(xLine-x) + y;
plot(x,y,'ro')
plot(xLine,yLine,'b')