Main Content

plotpc

Plot classification line on perceptron vector plot

Syntax

plotpc(W,B)
plotpc(W,B,H)

Description

plotpc(W,B) takes these inputs,

W

S-by-R weight matrix (R must be 3 or less)

B

S-by-1 bias vector

and returns a handle to a plotted classification line.

plotpc(W,B,H) takes an additional input,

H

Handle to last plotted line

and deletes the last line before plotting the new one.

This function does not change the current axis and is intended to be called after plotpv.

Examples

Plot Classification Line

The code below defines and plots the inputs and targets for a perceptron:

p = [0 0 1 1; 0 1 0 1];
t = [0 0 0 1];
plotpv(p,t)

Figure contains an axes object. The axes object with title Vectors to be Classified, xlabel P(1), ylabel P(2) contains 4 objects of type line. One or more of the lines displays its values using only markers

The following code creates a perceptron, assigns values to its weights and biases, and plots the resulting classification line.

net = perceptron;
net = configure(net,p,t);
net.iw{1,1} = [-1.2 -0.5];
net.b{1} = 1;
plotpc(net.iw{1,1},net.b{1})

Figure contains an axes object. The axes object with title Vectors to be Classified, xlabel P(1), ylabel P(2) contains 5 objects of type line. One or more of the lines displays its values using only markers

Version History

Introduced before R2006a

See Also