粉红噪声matlab产生

42 篇文章 6 订阅

 粉红噪声是一种无规则的噪声,具有连续的噪声谱,其功率与频率呈反比,频率成分比白噪声多,在固定的倍频程带宽内,声能量相同的。如低频125~250Hz带宽与高频2K~4K带宽内能量是相同的。

白噪声属于全频噪声,主要用来测量电声设备,粉红噪声是根据人耳的听觉特性与习惯
设计出的测量噪声,主要用来模拟人的听觉,测量厅堂的声学特性

function out = create_pink_noise(Fs, Sec, Amp)

% Creates a pink noise signal and saves it as a wav file
%
% Usage: create_noise(Fs, Sec, Amp);
%
%        Fs is the desired sampling rate
%        Sec is the duration of the signal in seconds
%        Amp is the amplitude in dB of the signal (0dB to -144dB)
%
% Author: sparafucile17 06/14/02

%error trapping
if((Amp > 0) || (Amp < -144))
    error('Amplitude is not within the range of 0dB to -144dB');
end

%Create Whitenoise
white_noise = randn((Fs*Sec)+1,1);

%Apply weighted sum of first order filters to approximate a -10dB/decade
%filter.  This is Paul Kellet's "refined" method (a.k.a instrumentation
%grade)  It is accurate to within +/-0.05dB above 9.2Hz
b=zeros(7,1);
for i=1:((Fs*Sec)+1)
    b(1) = 0.99886 * b(1) + white_noise(i) * 0.0555179;
    b(2) = 0.99332 * b(2) + white_noise(i) * 0.0750759;
    b(3) = 0.96900 * b(3) + white_noise(i) * 0.1538520;
    b(4) = 0.86650 * b(4) + white_noise(i) * 0.3104856;
    b(5) = 0.55000 * b(5) + white_noise(i) * 0.5329522;
    b(6) = -0.7616 * b(6) - white_noise(i) * 0.0168980;
    pink_noise(i) = b(1) + b(2) + b(3) + b(4) + b(5) + b(6) + b(7) + white_noise(i) * 0.5362;
    b(7) = white_noise(i) * 0.115926; 
end

%Normalize to +/- 1
if(abs(min(pink_noise)) > max(pink_noise))  
    pink_noise = pink_noise / abs(min(pink_noise));
else
    pink_noise = pink_noise / max(pink_noise);
end

%Normalize to prevent positive saturation (We can't represent +1.0)
pink_noise = pink_noise /abs(((2^31)-1)/(2^31));

%Scale signal to match desired level
pink_noise = pink_noise * 10^(Amp/20);

%Output noise signal
out = pink_noise(1:end-1);

这里使用了两种 Paul Kellet 的滤波方法 降低误差,滤波系数是

Here are some new lower-order pink noise filter coefficients.

These have approximately equiripple error in decibels from 20hz to 20khz at a 44.1khz
sampling rate.

1st order, ~ +/- 3 dB error (not recommended!)
num = [0.05338071119116  -0.03752455712906]
den = [1.00000000000000  -0.97712493947102]

2nd order, ~ +/- 0.9 dB error
num = [ 0.04957526213389  -0.06305581334498   0.01483220320740 ]
den = [ 1.00000000000000  -1.80116083982126   0.80257737639225 ]

最上面的使用更高阶次的实现滤波相关 减小误差

 

  • 6
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 11
    评论
粉红噪声Matlab中是通过一组函数来实现的。这组函数提供了不同斜率的粉红噪声的功率谱密度。其中,粉红噪声的功率谱密度与频率呈反比关系,即频率越低,功率越高。这种噪声谱在固定的倍频程带宽内具有相同的能量。例如,在低频125~250Hz带宽和高频2K~4K带宽内的能量是相同的。 在Matlab中,为了降低误差,可以使用Paul Kellet的滤波方法。这里提供了两种滤波方法的系数,分别是一阶和二阶的。这些滤波系数在44.1kHz采样率下,从20Hz到20kHz的范围内有近似均衡的衰减误差。一阶滤波器的误差约为-3dB,二阶滤波器的误差约为-0.9dB。 因此,通过使用Matlab中的相关函数和滤波方法,你可以实现粉红噪声生成和处理。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [使用 Matlab 生成粉红色、红色、蓝色和紫色噪声:通过白噪声的光谱处理生成粉红色、红色、蓝色和紫色噪声。...](https://download.csdn.net/download/weixin_38747946/19195953)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [粉红噪声matlab产生](https://blog.csdn.net/xinshuwei/article/details/107914856)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢娘蓝桥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值