% % 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. % %----- close all; drawnow; clear functions; rehash; clc; r_k = [ 1, -0.32, 0.2, 0.05, -0.06, -0.08 ]; n_r_k = length(r_k); n = 100; sf=figure; stem( 0:(n_r_k-1), r_k, 'markerfacecolor', 'b' ); xlabel( 'lag (k)' ); ylabel('r_{a}(k)'); se_r_k = 1.0 / sqrt(n); % plot the value of the standard errors of the sample autocorrelations: figure(sf); hold on; plot( 0:(n_r_k-1), -2*se_r_k*ones(n_r_k,1), 'r-' ); figure(sf); hold on; plot( 0:(n_r_k-1), +2*se_r_k*ones(n_r_k,1), 'r-' ); axis tight; saveas( gcf, '../../WriteUp/Graphics/Chapter5/prob_5_9_a_k', 'epsc' ); % plot the sample partial autocorrelation function: % phi_kk = spacf(r_k(2:end)); n_r_k = length(phi_kk); sf=figure; stem( 1:n_r_k, phi_kk, 'markerfacecolor', 'b' ); xlabel( 'lag (k)' ); ylabel('\phi_{kk}'); se_r_k = 1.0 / sqrt(n); % plot the value of the standard errors of the sample autocorrelations: figure(sf); hold on; plot( 1:(n_r_k), -2*se_r_k*ones(n_r_k,1), 'r-' ); figure(sf); hold on; plot( 1:(n_r_k), +2*se_r_k*ones(n_r_k,1), 'r-' ); saveas( gcf, '../../WriteUp/Graphics/Chapter5/prob_5_9_phi_a_k', 'epsc' );