% This program illustrates a critical limitation of single-layer neural %networks. The network is used to solve the XOR problem, which is not %linearly separable. clear all clc X = [0 0 1; 0 1 1; 1 0 1; 1 1 1]; D = [0; 1; 1; 0]; W = 2*rand(1, 3) - 1; % Training: max_epoch = 40000; for epoch = 1:max_epoch W = DeltaSGD(W, X, D); end %Inference: N = size(X,1); y = zeros(N,1); for k = 1:N x = X(k, :)'; v = W*x; y(k) = Sigmoid(v); end disp('Results:'); disp(' [desired neuron_output]'); disp([D y]);