⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sfrls2.m

📁 这是在国外某网站上下的一些自适应信号处理的源程序
💻 M
字号:

%SFRLS2 Problem 1.1.1.2.7
%
%   'ifile.mat' - input file containing:
%      I - members of ensemble
%      K - iterations
%      a1 - coefficient of input AR process
%      sigmax - standard deviation of input
%      Wo - coefficient vector of plant
%      sigman - standard deviation of measurement noise
%      epsilon - small auxiliary constant
%      kappa1, kappa2, kappa3 - auxiliary parameters
%      lambda - forgetting factor
% 
%   'ofile.mat' - output file containing:
%      ind - sample indexes 
%      M - misadjustment 

clear all	% clear memory
load ifile;	% read input variables
sigmav=sigmax*sqrt(1-a1^2);	
		% standard deviation of input to AR process
L=length(Wo);		% plant and filter length
N=L-1;			% plant and filter order
L1=L+1;			% auxiliary constant
MSE=zeros(K,1);		% prepare to accumulate MSE*I
MSEmin=zeros(K,1);	% prepare to accumulate MSEmin*I

for i=1:I,		% ensemble
   Xe=zeros(L1,1);	% extended initial memory
   v=randn(K,1)*sigmav;		% input to AR process
   x=filter([1,0],[1,a1],v);	% input 
   n=randn(K,1)*sigman;		% measurement noise 
   %
   % initial coefficient vectors
   Wb=zeros(L,1);	
   Wf=Wb;	
   W=Wb;	
   %
   % initialization
   phih=zeros(L,1);
   gamma=1;
   xibmin=epsilon;
   ixifmin=1/epsilon;
   for k=1:K,		% iterations
      Xe=[x(k)
          Xe(1:L)];	% new extended input vector
      %
      % predictions
      efp=Xe'*[1 
                 -Wf];
      ef=efp*gamma;
      phihe=[0
             phih]+ixifmin/lambda*[1
                                   -Wf]*efp;
      gamma=1/(1/gamma+phihe(1)*efp);		% gamma1
      ixifmin=ixifmin/lambda-gamma*(phihe(1))^2;
      Wf=Wf+phih*ef;
      ebp1=lambda*xibmin*phihe(L1);    
      ebp2=[-Wb' 1]*Xe;     
      ebp=[1-kappa1 kappa1
           1-kappa2 kappa2
           1-kappa3 kappa3]*[ebp1 
                             ebp2];
      gamma=1/(1/gamma-phihe(L1)*ebp(3));	% gamma2
      eb=gamma*ebp;
      xibmin=lambda*xibmin+eb(2)*ebp(2);
      phih=phihe(1:L)+phihe(L1)*Wb;
      Wb=Wb+phih*eb(1);
      gamma=1/(1+phih'*Xe(1:L));			% gamma3
      %
      % joint-process estimation
      d=Wo'*Xe(1:L);		% desired signal sample
      ep=d+n(k)-W'*Xe(1:L);
      e=ep*gamma;		% error sample
      W=W+phih*e;		% new coefficient vector
      MSE(k)=MSE(k)+ep^2;	% accumulate MSE*I
      MSEmin(k)=MSEmin(k)+(n(k))^2;	% accumulate MSEmin*I
   end
end

ind=0:(K-1);		% sample indexes
M=MSE./MSEmin-1;	% calculate misadjustment
save ofile ind M;	% write output variables

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -