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

📄 nlrls1.m

📁 学习通信的人都知道
💻 M
字号:

%NLRLS1 Problem 1.1.1.1.2.5
%
%   'ifile.mat' - input file containing:
%      I - members of ensemble
%      K - iterations
%      sigmax - standard deviation of input
%      Wo - coefficient vector of plant
%      sigman - standard deviation of measurement noise
%      epsilon - small auxiliary constant
%      lambda - forgetting factor
%      b - bits in decimal part
% 
%   'ofile.mat' - output file containing:
%      ind - sample indexes 
%      MSNE - mean-square normalized error

clear all	% clear memory
load ifile;	% read input variables
L=length(Wo);		% plant and filter length
N=L-1;			% plant and filter order
MSNE=zeros(K,1);	% prepare to accumulate MSNE*I

for i=1:I,		% ensemble
   X=zeros(L,1);    	% initial memory
   x=randn(K,1)*sigmax;		% input 
   n=randn(K,1)*sigman;		% measurement noise 
   %
   % initial parameters
   deltan=zeros(1,L);
   deltaDn=zeros(1,L);
   oldebn=zeros(1,L);
   sigma2x=epsilon;
   sigma2d=epsilon;
   for k=1:K,		% iterations
      X=[x(k)		
         X(1:N)];	% new input vector
      d=Wo'*X+n(k);		% desired signal sample
      sigma2x=lambda*sigma2x+(x(k))^2;	% input signal power
      sigma2x=qround(sigma2x,b);
      sigma1x=qround(sqrt(sigma2x),b);
      sigma2d=lambda*sigma2d+d^2;	% desired signal power
      sigma2d=qround(sigma2d,b);
      sigmad=qround(sqrt(sigma2d),b);
      %
      % initialization
      ebn(1)=x(k)/sigma1x;
      efn=ebn(1);
      en=d/sigmad;
      for j=1:L,	% orders
         %
         % auxiliary parameters
         oldauxeb=qround(sqrt(qround((1-(oldebn(j))^2),b)),b);
         auxeb=qround(sqrt(qround((1-(ebn(j))^2),b)),b);
         auxef=qround(sqrt(qround((1-efn^2),b)),b);
         deltan(j)=deltan(j)*oldauxeb*auxef+oldebn(j)*efn;
         deltan(j)=qround(deltan(j),b);
         auxdelta=qround(sqrt(qround((1-(deltan(j))^2),b)),b);
         %
         % prediction errors
         ebn(j+1)=qround((oldebn(j)-deltan(j)*efn),b)/auxdelta/auxef;
         efn=qround((efn-deltan(j)*oldebn(j)),b)/auxdelta/oldauxeb;
         %
         % feedforward filtering
         deltaDn(j)=deltaDn(j)*auxeb*qround(sqrt(qround((1-en^2),b)),b)+en*ebn(j);
         deltaDn(j)=qround(deltaDn(j),b);
         auxdeltaD=qround(sqrt(qround((1-(deltaDn(j))^2),b)),b);
         en=qround((en-deltaDn(j)*ebn(j)),b)/auxeb/auxdeltaD;
      end
      MSNE(k)=MSNE(k)+en^2;	% accumulate MSNE*I
      %
      % updated parameter
      oldebn=ebn;
   end
end

ind=0:(K-1);		% sample indexes
MSNE=MSNE/I;		% calculate misadjustment
save ofile ind MSNE;	% write output variables

⌨️ 快捷键说明

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