Advertisement
stiansjogren

Levinson

Jan 7th, 2016
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.54 KB | None | 0 0
  1. function [a,k,Jo]=levdur(r,p)
  2.    
  3.     % Input: r(m), 0<=m<=p
  4.     % Output:
  5.     a=zeros(p+1,1); % Prediction error filter
  6.     k=zeros(p,1);
  7.     % Lattice parameters
  8.     Jo=zeros(p+1,1); % LP MMSE for 0<=m<=M
  9.     % Initialization
  10.     J=r(1); Jo(1)=J;
  11.     beta=r(2); k(1)=-beta/J; a(1)=k(1);
  12.     J=J+beta*k(1); Jo(2)=J;
  13.     % Recursion
  14.     for m=2:p
  15.         beta=(r(2:m))'*flipud(a(1:m-1))+r(m+1);
  16.         k(m)=-beta/J;
  17.         a(1:m)=[(a(1:m-1))' 0]'+[(flipud(a(1:m-1)))' 1]'*k(m);
  18.         J=J+beta*k(m); Jo(m+1)=J;
  19.     end
  20.     a(2:p+1)=a(1:p); a(1)=1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement