原始信号为正弦信号,通过MATLAB编程给正弦信号加入高斯白噪声。将含有噪声的信号通过线累加平均算法来去除噪声。
%% 线性累加算法
clc;clear;
% 1、加入高斯白噪声
fi = 1;% 正弦信号频率
fs = 100;%采样频率
t = 0:1/fs:10;
f = 1*sin(t)+2*sin(2*t);%原始信号
y1 = 0.3 * randn(size(f));%高斯白噪声
N = 256;
y2 = f + y1;%叠加了高斯白噪声的含噪信号
y3 = y2;%多次累加后的含噪信号
for i = 1 : N-1
y3 = y3 + 0.3 * randn(size(f))+ f;%原正弦波信号叠加上高斯噪声信号,y2为含噪信号
end
y3 = y3 / N;%取平均值
subplot(411);
plot(t,f), title('正弦波形'), grid on;
subplot(412);
plot(t,y1), title('高斯白噪声波形'), grid on;%扰动范围0-1
subplot(413);
plot(t,y2,'g'), title('叠加高斯白噪声后的正弦波形'), grid on;
subplot(414);
plot(t,y3,'b'), title([num2str(N),'次累加平均']), grid on;
不同累加次数对含噪信号的影响: