function theta = idRecursiveEstimationProcessParametersRarx(A,B,na,nb,nk,nParameters)
% idRecursiveEstimationProcessParametersRarx Helper function to construct
% the vector of free estimated parameters from the A and B polynomials. It
% is assumed that A(1)=1

%   Copyright 2013-2017 The MathWorks, Inc.

%#codegen
theta = zeros(nParameters,1,'like',A);
% Initial A(q)
endIdx = na;
if na>0
    theta(1:endIdx) = A(2:end);
end
% Initial B(q)
if any(nb>0)
    theta(endIdx+1:nParameters) = ...
    idRecursivePolynomialModelEstimator.extractParametersFromB(B,nb,nk);
end