www.pudn.com > AR_MATLAB.rar > ARpredictor_SeqGen.m


% File: ARpredictor_SeqGen.m 
% -------------------------- 
% This file is used to generate WGN w(n) and s(n) 
 
function ARpredictor_SeqGen(a_vector, sigma_sqr, L) 
% a_vector: the parameters a(i) i = 1, ..., p of AR model in vector form 
%       also with the order (or length) of the model p = length(a_vector) 
% sigma_sqr: variance of white Gaussian noise 
% L: number of signal samples of s(n) 
wgnvector_w = sqrt(sigma_sqr) * randn(L, 1); % generate w(n) of length L 
signalvector_s = zeros(L, 1); % predefine the signal s(n) of length L 
p = length(a_vector); % the order(length) of AR model. 
for n = 1: L 
    signalvector_s(n) = wgnvector_w(n) - ARpredictor_SG(a_vector, signalvector_s, p, n); 
end 
 
savefile = 'ARpredictor_SeqGen.mat'; 
save(savefile, 'p', 'sigma_sqr', 'a_vector', 'wgnvector_w', 'signalvector_s', 'L'); 
 
clear;