我想问下怎样在yy(tt1)=10*sin(0.8*pi*tt/4)这个函数中加一个信噪比为65的高斯白噪声??eight写的那篇有关噪声的帖子我也看了,但是我不是很懂,所以想问下这个加噪声的具体程序该怎样写,另外就是我这个算的是浮点运算,如果我想改成定点运算又该怎样写??
function yy=yt(tt)
tt1=1;
for tt=tt-511:+1:tt
yy(tt1)=10*sin(0.8*pi*tt/4);
tt1=tt1+1;
end
clear;
u=input('输入数值u:')
%u=1/(256*50)/1;
nn=10000;
r=0;
%for i=1:2
for t=1:512
a(t)=0;
p(t)=0;
%p(t)=0.99*p(t-1)+0.01*(10*sin(0.8*pi*t/4))^2;
%e(t)=5*sin(0.8*pi*t/4+pi/30)-r;
%y(t)=10*sin(0.8*pi*t/4);
%a(t)=a(t-1)+u*e(t)*y(t);%./p(t);
%H(t)=a(t)*10*sin(0.8*pi*(513-t)/4);
%H(t)=a(t)*10*sin(0.8*pi*(t)/4);
end
for t=512:nn
p(t)=0.99*p(t-1)+0.01*(10*sin(0.8*pi*t/4))^2;
y=yt(t);
yu=a*y';
e(t)=5*sin(0.8*pi*t/4)-a*y';%+pi/30
%e=-a*y'
a=a+u*e(t)*y/p(t);
end
%r=sum(H);
%for t=512:nn
%p(t)=0.99*p(t-1)+0.01*(10*sin(0.8*pi*t/4))^2;
% e(t)=5*sin(0.8*pi*t/4+pi/30)-r;
% y(t)=10*sin(0.8*pi*t/4);
% a(t)=a(t-1)+u*e(t)*y(t);%./p(t);
% rr=0;
% for t1=0:511
%rr=rr+H(t-513+t1-1)=a(t-513+t1-1)*10*sin(0.8*pi*(t-t1+2)/4);
% rr=rr+a(t-t1)*10*sin(0.8*pi*(t-t1)/4);
%rr=rr+a(t-513+t1)*10*sin(0.8*pi*(t-513+t1)/4);
% end
%r=sum(H);
% r=rr;
% end
%end
%for t=2:512
%e(t)=5*sin(800*(t+pi/3))-r;
%end
%x=1:10000;
plot(e)