Calculation of decision boundaries with Perceptron

here i will train perceptron and plot decision boundaries (target is generated so I am sure that it is lineary separable). For sake of the example, there is no bias.

 numinput=5;
net=newp([-1 1; -1 1], 1); %2 inputs between -1 and 1, 1 neuron
net.IW{1,1}=rands(1,2);
P=rands(2,numinput);
T=sim(net,P);
plotpv(P,T);
hold on;
plotpc(net.IW{1,1},0);


This is the result:

P has following values:

-0.2592   -0.0364    0.3828    0.0246   -0.0691
-0.2451    0.5912    0.6996    0.7101   -0.4703


And weights are:

-0.3462   -0.7939


I understand the idea behind, but how, with those weights, the decision line is plotted?

Let's say I want plot the chart by hand, how I caculate the line given the weights?

I know, elementary math, I just cannot see it now.

With no intercept and two weights ($\theta_1$ and $\theta_2$) as in the OP, the decision boundary line is at:

$0 = \theta_1 x_1 + \theta_2 x_2$

Hence, since the plot is of $x_2$ versus $x_1$, we choose two extreme points along $x_1$ included in the plot (plus some margin) and calculate the expected $x_2$ at the decision boundary:

$\large x_2 = \frac{- \theta_1 x_1} {\theta_2}$

In the OP, the two values along $P(1)$ could be arbitrarily chosen to be $-.7$ and $+.7$, yielding corresponding $P(2)$ values at the decision boundary line of $0.3052526$ and $-0.3052526$, respectively. Now it's just a matter of drawing a line between points $(-.7,.305)$ and $(.7,-.305)$.

I guess in Matlab it would only remain to run x=[-.7,.7]; y=[.305,-.305]; plot(x,y), but in R, the whole process would be:

    data=t(as.matrix(data))
data = cbind(data,c(1,0,0,0,1))
colnames(data) = c("P(1)","P(2)","classifier")
rownames(data) = NULL

plot(data, xlim=c(-.6,.65), ylim=c(-1,1.5),
pch = c(1,3)[as.factor(data[,3])],
col = c("blue","red")[as.factor(data[,3])],
cex=1.5,
main="Vectors to be Classified")
abline(h=0)
abline(v=0)

min(data[,1])

x1 = -.7
x2 = .7
w1 = -0.3462
w2 = -0.7939
y1 = (1/w2) * (- x1 * w1)
y2 = (1/w2) * (- x2 * w1)

lines(c(x1,x2),c(y1,y2), lwd = 3, col="darkorange4")