I am trying to make a simple XOR gate in Matlab just to demonstrate a feed forward network but I am having trouble in getting the output to match my target. I'm pretty new to ANN in Matlab so any help would be greatly appreciated. Here is my simple code:
% XOR gate
x = [0 0 1 1; 0 1 0 1] ;
t = [0,1,1,0];
net = feedforwardnet(2);
net = train(net,x,t);
y = net(x)
disp("Weights:")
disp(net.IW{1})
disp("Bias:")
disp(net.b{1})
The last bit is just used so I can see the weights and biases used. For some context, this is just from a problem sheet where previously I created an OR and AND gate for example but these are linearly separable so I could do it with a single perceptron! This XOR gate has me quite confused tho!
Thanks in advance for any help :D
EDIT: Just an update for anyone coming across this who isn't helped by the other posts provided, I managed to solve the XOR gate using a radial basis function (newrb in Matlab) and it gave a perfect results from the given target. :)