function [a,PM] = stepup(k,P0)
% Lattice form to Direct form Conversion
% --------------------------------------
% [a,PM] = stepup(k,P0)
% a = direct form coefficients (impulse response)
% PM = Final error variance
% k = Lattice filter coefficients (reflection coefficients)
% P0 = Initial error variance
%
%-----------------------------------------------------------
% Copyright 2000, by Dimitris G. Manolakis, Vinay K. Ingle,
% and Stephen M. Kogon. For use with the book
% "Statistical and Adaptive Signal Processing"
% McGraw-Hill Higher Education.
%-----------------------------------------------------------
% Initialization
P = P0;
a = [];
% Recursion;
M = length(k);
for m = 1:M
a = [a;0] + [flipud(conj(a));1]*k(m);
P = P*(1-k(m)*conj(k(m)));
end
PM = P;