%This program calls in the function DeltaBatch.m for supervised training of %a neural network. clear all clc X = [0 0 1; 0 1 1; 1 0 1; 1 1 1]; D = [0; 0; 1; 1]; W = 2*rand(1, 3) - 1; %Training (adjusting weights): max_epoch = 10000; for epoch = 1:max_epoch W = DeltaBatch(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); %obtained output. end disp('Results:'); disp(' [desired neuron_output]'); disp([D y]);