function [ SSR ] = Varx2( theta, U, Y , xo)
%VARX1 evaluate the sum of the preidcion error for the following ARX model
% y(k+1) = a1*y(k) + b2*y(k-1) + b*u(k-1) + e(k+1)
%
%   [ SSR ] = Varx2( theta, U, Y, xo )
%
%Input values
%   theta   : column vector storing the paramethers [a b1 b2]'
%   U       : column vector storing the input data
%   Y       : column vector storing the output data
%   xo      : intial state for simulation  [y(0), u(0), u(-1)]


genTheta = [theta(1); 0; theta(2:3)];
genXo = [xo(1); 0 ; xo(2:3)];
Yp = ArxPred( U,Y,  genTheta,genXo);

SSR = sum((Yp -Y).^2);

