如何用MATLAB怎么产生随机噪声给信号加莱斯噪声?

function [y,noise] = Gnoisegen(x,snr)
% Gnoisegen函数是叠加高斯白噪声到语音信号x中
% [y,noise] = Gnoisegen(x,snr)
% x是语音信号,snr是设置的信噪比,单位为dB
% y是叠加高斯白噪声后的带噪语音,noise是被叠加的噪声
noise=randn(size(x));
% 用randn函数产生高斯白噪声
Nx=length(x);
% 求出信号x长
signal_power = 1/Nx*sum(x.*x);
% 求出信号的平均能量
noise_power=1/Nx*sum(noise.*noise);% 求出噪声的能量
noise_variance = signal_power / ( 10^(snr/10) );
% 计算出噪声设定的方差值
noise=sqrt(noise_variance/noise_power)*noise;
% 按噪声的平均能量构成相应的白噪声
y=x+noise;
% 构成带噪语音
分类专栏
您愿意向朋友推荐“博客详情页”吗?
强烈不推荐
不推荐
一般般
推荐
强烈推荐
}
Skip to content
This example shows how to subtract noise from an input signal using the Recursive Least Squares (RLS) algorithm. The RLS adaptive filter uses the reference signal on the Input port and the desired signal on the Desired port to automatically match the filter response in the Noise Filter block. As it converges to the correct filter, the filtered noise should be completely subtracted from the "Signal+Noise" signal, and the "Error Signal" should contain only the original signal.
For details, see S. Haykin, Adaptive Filter Theory, 3rd Ed., Prentice-Hall 1996.
Select a Web SiteChoose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .You can also select a web site from the following list:EuropeContact your local office
Try MATLAB, Simulink, and Other ProductsGet trial now
}

我要回帖

更多关于 MATLAB怎么产生随机噪声 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信