% % 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; % now plot the "convergence" or not of these weights % n = 0:7; rx0 = 1.0; w0 = -.5; % our initial guess ... wopt = 0.5; % the optimal value ... figure; hold on; % pick some values of mu: % mu = 0.5 * ( 1/(2*rx0) ); % <- we should easily converge ... wn = wopt + ( ( 1 - 2*mu*rx0 ).^n ) * ( w0 - wopt ); mu1 = plot( n, wn, 'bo-' ); mu = ( 1/(2*rx0) )-1e-6; % <- we should still converge ... wn = wopt + ( ( 1 - 2*mu*rx0 ).^n ) * ( w0 - wopt ); mu2 = plot( n, wn, 'rx-' ); mu = 0.5 * ( 1/(2*rx0) + 1/rx0 ); % <- we converge by via osscilations ... wn = wopt + ( ( 1 - 2*mu*rx0 ).^n ) * ( w0 - wopt ); mu3 = plot( n, wn, '-gd' ); mu = 1.5 * ( 1/rx0 ); % <- we diverge ... wn = wopt + ( ( 1 - 2*mu*rx0 ).^n ) * ( w0 - wopt ); mu4 = plot( n(1:5), wn(1:5), '-cs' ); axis( [0,max(n),-2,+2] ); xlabel('n (index)'); ylabel('w(n)'); legend( [mu1,mu2,mu3,mu4], {'Part (a)','Part (b)','Part (c)','Part (d)'} ); grid on; saveas( gcf, '../../WriteUp/Graphics/Chapter6/prob_6_1_2', 'epsc' );