function theta = idRecursiveEstimationProcessParametersRoe(B,F,nb,nf,nk,nParameters)
% idRecursiveEstimationProcessParametersRoe Helper function to construct
% the vector of free estimated parameters from the B and F polynomials.

%   Copyright 2014-2017 The MathWorks, Inc.

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