run_rls_eq.m
上传用户:kendun0711
上传日期:2007-06-03
资源大小:32k
文件大小:1k
- function rsleq(rp)
- % Computer Experiment
- % Section 13.7, Adaptive Filter Theory, 3rd edition
- % Adaptive equalization
- seed = 0:(rp.Niter-1);
- h = [1/2*(1+cos(2*pi/rp.T*((1:3) - 2)))];
- Npred = rp.Ndata - 1 - rp.p;
- A = zeros(rp.Niter, Npred);
- E = zeros(rp.Niter, Npred);
- Wx = zeros(rp.p, Npred);
- for iter = 1:rp.Niter,
- disp([rp.T iter])
- rand('seed', seed(iter));
- randn('seed', seed(iter));
- a = [2*(rand(rp.Ndata, 1) > 0.5) - 1];
- Xi = conv(a, h);
- % account for shift in input sequence introduced by
- % convolution with h and offset 1 addressing in MATLAB
- Xi = Xi((length(h)+1):length(Xi));
- keyboard
- Xi = Xi + sqrt(rp.var_v)*randn(length(Xi), 1);
- [Xi, Y] = mksstrndata(Xi, rp.p);
- Y = a((rp.tau+1):rp.Ndata);
- % keyboard
- [Wo, xp, alpha, e] = rls_AR_pred(Xi, Y, rp.verbose, rp.lambda, rp.delta);
- A(iter, :) = alpha;
- E(iter, :) = e;
- Wx = Wx + Wo;
- end; % for iter
- Wx = Wx / rp.Niter;
- eval(['save ', rp.name])