function [o,o1,d1] = mlp_out(x,k,w1,w2)
%
%  Returns the output o of the one-layered MLP-network
%  defined in (4.13) in the lecture notes.
%
%  Input
%    x         input vector (must be a column vector)
%    k         vector of parameters for sigmoid
%    w1        matrix W_1
%    w2        matrix W_2
%
%  Output
%    o         output vector
%

rx = length(x);
[r1,c1] = size(w1);
[r2,c2] = size(w2);

if (c1 ~= rx+1)
   error('input x and w1 incompatible.');
elseif (c2 ~= r1+1)
   error('matrices w1 and w2 incompatible.');
end

h = w1*[ 1 ; x ];
[o1,d1] = sigmoid(h,k);
o = w2*[ 1 ; o1 ];
