hlayumi的个人空间 https://blog.eetop.cn/hslogic [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

maltab信号处理一个案例 源码程序下载

已有 9435 次阅读| 2017-12-19 00:11 |系统分类:硬件设计

clear
clc

h(1,:)=[ 0.25  1  0.25];
h(2,:)=[ 0.25  1 -0.25];
h(3,:)=[-0.25  1  0.25];
a_color=['b','g','r'];
figure;
for j=1:3
hi=h(j,:);

N=1500;  00Bit
v=0.001; % buchang
sigma2=0.01;   %sigma^2
sigma=sqrt(sigma2);   %sigma

e2=zeros(100,N);
for n=1:100    0ci
s=2*randint(1,N)-1;
u=conv(s,hi);
u=u+sigma*randn(1,length(u));

% figure
% subplot(211);stem(s);
% subplot(212);stem(u);

u=[zeros(1,20) u];
w=zeros(1,21)';
x=[u(21+12:-1:1+12)]';
y=w'*x;
e=x(1)-y;
J=zeros(1,N);
J(13)=e^2;
w=w+v.*x*e;

for i=14:N
    x=[u(20+i:-1:i)]';
    y=w'*x;
    d=s(i-12);
    e(i)=d-y;
    w=w+v.*x*e(i);
    J(i)=e(i)^2;
end
e2(n,:)=J;
end;
e2o=mean(e2);


plot(e2o,a_color(j));hold on
end
title(['LMS-e^2(n)  \sigma^2=',num2str(sigma2)]);grid
xlabel('n');ylabel('e^2(n)')
legend('H_1(Z)','H_2(Z)','H_3(Z)');hold off;
    % RLS
% Made by shuimu 
% 2014/5/25

clear
clc

h(1,:)=[ 0.25  1  0.25];
h(2,:)=[ 0.25  1 -0.25];
h(3,:)=[-0.25  1  0.25];
a_color=['b','g','r'];
lamda=[0.98 0.9 0.75];
sigma2=0.01;   %sigma^2
sigma=sqrt(sigma2);   %sigma
for m=1:3
    v=lamda(m); % yiwang
    figure;
for j=1:3
hi=h(j,:);

N=100;

e2=zeros(1,N);
for n=1:100    0ci
s=2*randint(1,N)-1;
u=conv(s,hi);
u=u+sigma*randn(1,length(u));

% figure
% subplot(211);stem(s);
% subplot(212);stem(u);
deta=0.005*var(u);
% deta=var(u)
% Q=deta*eye(21);
P=(1/deta)*eye(21);  %initial P(0)
u=[zeros(1,20) u];
w=zeros(1,21)';
x=[u(21+12:-1:1+12)]';
k=v^(-1).*P*x/(1+v^(-1).*x'*P*x); %k(13)
y1=w'*x;
e=x(13-12)-y1;  %e(13)
J=zeros(1,N);
J(13)=e^2;
w=w+k*e;
P=v^(-1).*P-v^(-1).*k*x'*P; %P(13)
y=w'*x;

for i=14:N
    x=[u(20+i:-1:i)]';
%     y=w'*x;
%     d=s(i-12);
%     e(i)=d-y;
%     w=w+v.*x*e(i);
%     J(i)=e(i)^2;
    
    k=v^(-1).*P*x/(1+v^(-1).*x'*P*x);
    y1=w'*x;
    e=s(i-12)-y1;
    J(i)=e^2;
    w=w+k*e;
    P=v^(-1).*P-v^(-1).*k*x'*P;

end
e2(n,:)=J;
end;
e2o=mean(e2);

plot(e2o,a_color(j));hold on
end
title(['RLS-\epsilon^2(n)  \lambda=',num2str(v),'  \sigma^2=',num2str(sigma2)]);grid
xlabel('n');ylabel('\epsilon^2(n)')
legend('H_1(Z)','H_2(Z)','H_3(Z)');
end

点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 5

    粉丝
  • 0

    好友
  • 1

    获赞
  • 16

    评论
  • 5260

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-25 23:25 , Processed in 0.017100 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部