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

📄 testrlslfpef.m

📁 卡尔曼滤波器设计的一个例子
💻 M
字号:
% RLSLFPEF used in a adaptive line enhancer application.
% By the end of this script, the forward prediction error 
% is the wide-band signal and the output of the equivalent 
% transversal predictor is the narrow-band signal.

clear all;
iter = 5000;
t    = (1:iter)/1000;           % time index @ 1kHz
xn   = 2*(rand(iter,1)-0.5)  ;  % Input signal, zero mean random.
xn   = xn + 1 * cos(2*pi*50*t');
yn   = zeros(iter,1);           % narrow-band signal
en   = yn;                      % error signal

% Initialize RLSLFPEF
M    = 10;                      % filter length
a    = 0.99;                    % forgetting factor
[ff,bb,fb,cf,b,y,e,kf,kb] = init_rlslfpef(M);  % Init RLSLFPEF

%% Processing Loop
for (m=1:iter)
   [ff,bb,fb,cf,b,y,e,kf,kb,c]=asptrlslfpef(ff,bb,fb,cf,b,a,xn(m));
   yn(m,:) = y;              % save narrow-band
   en(m,:) = e;              % save wide-band
end;

% Transfer function between e(n) and x(n).
h = filter([1 ; -c],1,[1;zeros(1023,1)]);
f = (0:512)*500/512;
H = 20*log10(abs(fft(h)));
% display the results
subplot(2,2,1);plot(f,H(1:513,:)); grid;
xlabel('frequency [Hz]')
ylabel('amplitude [dB]')
subplot(2,2,2);
plot([yn(4800:5000)]);grid
axis([0 200 -1 1]);
ylabel('filter output')
xlabel('time [samples]')

⌨️ 快捷键说明

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