开发者

How to plot the line that separates 2 classes,using output of perceptron MATLAB

after running the perceptron code in Matlab I get the following weights:

result=
    2.5799
    2.8557
    4.4244
   -4.3156
    1.6835
   -4.0208
   26.5955
  -12.5730
   11.5000

If i started with these weights :

w = [ 1 1 1 1 1 1 1 1 1]'; 

How do I plot the line that separates the 2 classes. Is necessary to solve a linear system, but how?

开发者_C百科Line = [result,w] 

% solve the linear system, am I correct doing this?
rref(Line')
  • Is it correct the way to calculate the values, that will be use to plot?
  • How to plot the line?? any example???


Yaux = sign(w'*X);  % w is the result of calling perceptron
scatter(X(1,:),X(2,:),100,Yaux);
hold on;
plot([0 w(1)], [0 w(2)]); 
hold off; 

seems to work for 2 dimension

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜