function [mse,theta] = l_mse(y,L,X)
% Find the best theta for the Laguerre problem and compute
% the mse. 
%    y is the output of the true system
%    L is the regressor matrix (taps of the Laguerre blocks)
%    X = inv(L'*L)*L'*y;
%
% Compute the optimal laguerre coefficients

S=size(y) ; S=S(1,1);
theta = X * y;

% Compute the minimum MSE
y_hat = (theta'*L')';

mse = ((y - y_hat)'*(y - y_hat))/(y'*y) ;

%plot(1:S,y,1:S,y_hat);
%disp('.')
%pause
