% % Written by: % -- % John L. Weatherwax 2008-11-24 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clear functions; clear; clc; close all; drawnow; R_x = [ 1, 0.7; 0.7, 1 ]; p = [ 0.7, 0.5 ].'; [Q,Lambda] = eig(R_x); %lambda_max = max(diag(Lambda)); lambda_max = Lambda(2,2); 1/lambda_max pxdp = (Q.') * p; % now plot the "convergence" or not of these weights % n = 0:25; % these should converge: mu = 0.5; w1 = -pxdp(1) * (0.7071/0.3) * ( 1 - ( 1- 0.6 * mu ).^n ) + pxdp(2) * (0.7071/1.7) * ( 1 - ( 1- 3.4 * mu ).^n ) ; w2 = pxdp(1) * (0.7071/0.3) * ( 1 - ( 1- 0.6 * mu ).^n ) + pxdp(2) * (0.7071/1.7) * ( 1 - ( 1- 3.4 * mu ).^n ) ; figure; hw1=plot( n, w1, '-go' ); hold on; hw2=plot( n, w2, '-gx' ); % these should NOT converge: mu = 0.7; w1 = -(0.7071/0.3) * ( 1 - ( 1- 0.6 * mu ).^n ) + (0.7071/1.7) * ( 1 - ( 1- 3.4 * mu ).^n ) ; w2 = (0.7071/0.3) * ( 1 - ( 1- 0.6 * mu ).^n ) + (0.7071/1.7) * ( 1 - ( 1- 3.4 * mu ).^n ) ; hw3=plot( n(1:20), w1(1:20), '-ro' ); hw4=plot( n(1:20), w2(1:20), '-rx' ); grid on; xlabel('n index'); ylabel('filter weights w(n)'); axis( [1,n(end),-1.0,+1.0] ); saveas( gcf, '../../WriteUp/Graphics/Chapter6/prob_6_2_3', 'epsc' );