-
LMSnew.m是RLS与LMS算法的Matlab程序
资源介绍
rls与lms算法Matlab程序-LMSnew.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%RLS自适应滤波器性能分析
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
%clc
%close all
%%%%%%%%%%%%%%参数设置%%%%%%%%%%%%%%%%%%%%%%%
w=2.9;
forget_factor=0.995;
variance_v=0.001;
repeat_times=200;
iteration_times=2000;
filt_len=13;
delay=fix-1;
%%%%%%%%%%%%%%%%%%%%变量及数组初始化%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chan_factor=/w))/2;
Square_err=zeros;
%%%%%%%%%%%%%外循环,重复做repeat_times次实验,平均值%%%%%%%%%%%%%%%%
for loop1=1:repeat_times
%%%%%%%%%%%%%%内循环变量及数组初始化%%%%%%%%%%%%%%%%%%%%%%%%
Source=zeros;
W=zeros;
P=eye;
Pi=zeros;
K=zeros;
%%%%%%%%%%%%%内循环,做iteration_times次迭代%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:iteration_times
%%%%%%%%%%%%%%信源,产生等概率分布的正负1%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if rand<0.5
Source=-1;
else
Source=1;
end
end
%%%%%%%%%%%%%%信道,滤波和加噪声%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Revdata=filter randn*sqrt;
%%%%%%%%%%%%%%均衡器,基于LMS算法%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for loop2=1:iteration_times-filt_len 1
U=Revdata;
d=Source;
Pi=P*U;
K=Pi/;
e=d-W'*U;
W=W K*e;
P=P/forget_factor-K*U'*P/forget_factor;
Square_err=e.^2;
end
end
%%%%%%%%%%%%%%作图,显示结果%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Square_err_mean=sum)/repeat_times;
%semilogy;
plot;
hold off;
%figure;
%stem;
运行结果:
LMS:
Figure18.jpg
RLS:
Figure19.jpg
- 上一篇: ant-design-vue-jeecg:医院--前端
- 下一篇: java实现的布隆过滤器算法