function m = arx_with_regularization_with_SITB(Data,nn,kernel)
%function m = arx_with_regularization_with_SITB(Data,nn,kernel)
%
% Estimating Regularized ARX models using the System Identification Toolbox
% (version 9.0 (Matlab R2014a) or higher)
%
% Data: The input-output data (an iddata object)
% nn: nn=[na nb nk] The orders of the ARX model. na, nb, nk are scalars,
% being expanded to the size of Data.  
% Kernel: The regularization kernel, one of 'TC', 'SS' or 'DC'

na = nn(1);nb=nn(2);nk=nn(3);
[N,ny,nu]=size(Data);
aoi=arxRegulOptions;
    aoi.Advanced.SearchMethod='fmincon';
    aoi.RegulKernel=kernel;
    [L,R,hp]=arxRegul(Data,[na*ones(ny,ny),nb*ones(ny,nu),nk*ones(ny,nu)],aoi);
    ai=arxOptions;
    ai.Regularization.Lambda=L;
    ai.Regularization.R=R;
    m = arx(Data,[na*ones(ny,ny),nb*ones(ny,nu),nk*ones(ny,nu)],ai);