Matlab - Average White Noise PSD

3 views (last 30 days)
klaus ebert
klaus ebert on 21 Apr 2015
Hey, I am currenctly facing the following problem: I have an audiosignal-vector y with a length of about 1e6. I want to add white noise to this signal and display the noises psd, which should be as flat as possible. The way I tried it:
[y,fs]=audioread('test.wav');
snr=5;
r=awgn(y,snr,'measured')-y; % There are other ways to create wgn but this shouldnt be the problem
MATp = zeros(length(r),50);
for i = 1:50
e=awgn(y,snr,'measured')-y;
[q,w]=pwelch(e,[],[],length(e)*2-1,fs);
MATp(:,i)=q;
end
p=mean(MATp')';
plot(w,p);
This works okay, but the psd is still far from flat. With 10000 psds to average it should be fine but this is way uses way too much memory. I found some other solutions on the internet but they all just worked with very short vectors (<<1e6). Are there any solutions for my Problem?
Thanks! Klaus

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!