% % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- phi_1 = 1.2728; phi_2 = -0.81; rts = roots( [ -phi_2, -phi_1, 1 ] ); G_1inv = rts(1); G_2inv = rts(2); G_1 = 1/G_1inv; G_2 = 1/G_2inv; kArray = 0:3; % we only need the first three elements: numer = G_1 * ( 1 - G_2^2 ) * G_1.^kArray - G_2 * ( 1 - G_1^2 ) * G_2.^kArray ; denom = ( G_1 - G_2 ) * ( 1 + G_1 * G_2 ) ; rho_k = numer / denom % fill in the autocorrelation matrix: R_x = zeros(2,2); R_x(1,1) = rho_k(1); R_x(1,2) = rho_k(2)'; R_x(2,1) = rho_k(2); R_x(2,2) = rho_k(1); b_rhs = [ rho_k(2); rho_k(3) ]; % solve for the optimal coefficients: w = R_x \ b_rhs % compute the eigenvalues of R_x: er = eig(R_x) 1/max(er)