Adding noise (with a specified SNR) to a sine wave

38 visualizaciones (últimos 30 días)
xRah
xRah el 5 de Nov. de 2020
Comentada: Abhinav hace alrededor de 20 horas
Hello people, another question here. I have succesfully created my first audio signal using a sine wave with the specs below. I tried adding some noise at an SNR of 2.01dB but I am not 100% certain that I did it correctly. For my sampling time, I assumed it would be the # of samples/sampling rate? I would greatly appreciate any feedback possible.
% Generate a sound sample which consists of
% 22050s-1 sampling rate
% 2^14 samples
% Sine wave
% Amplitude 0.187
% Signal frequency (1.6)*187 Hz
% Add random noise with
% SNR = [187/90] dB
Fs = 22050;
Ts = 1/Fs;
%Time = Samples/Sampling rate = 0.74s
tt = 0: Ts : 0.74;
ff = 187*1.6
ss = 0.187 * sin(2*pi*ff*tt)
SNRdB = 187/90;
SNR = 10^(SNRdB/10);
noisy_signal = ss + SNR .* rand(size(ss));
sound(noisy_signal,Fs)
  5 comentarios
Walter Roberson
Walter Roberson el 5 de Nov. de 2020
noisy_signal = awgn(ss, SNRdb, 'db');
Abhinav
Abhinav hace alrededor de 20 horas
noisy_signal = awgn(ss, SNRdb, 'measured'); % Changed 'db' to 'measured'. This one worked for me.

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by