필터 지우기
필터 지우기

How to right use awgn after audioread?

조회 수: 2 (최근 30일)
Nik Rocky
Nik Rocky 2020년 6월 23일
답변: Devineni Aslesha 2020년 6월 26일
Hello,
I've already found some topics, but I still don't understand what's wrong.
I want to overlay x from audioread with a Gaussian white noise with different amplitudes
SNR = 20; %maximum value
[x,Fs] = audioread([fpath,fname],[st_smp,en_smp]); %read wav file
for i = 1:SNR %for any value from 1 to SNR
test=x; %save original from changing
test = awgn(test,i); %overlay with gaussian noise and SNR = 1 dB???
anotherF()
%figure
hold on
win = 2^round(log2(Fs)-3);
win = win*4;
step = round(win/8);
specx = getspecx(test,Fs);
myspec(test,Fs,win,step,win);
ylim([0 1000]);
xlabel('t_{seconds}')
ylabel('Rotation 1/s')
colormap jet
save(FileSave, 'Traj');
fig_name = [name,'_SNR_',num2str(i),'_PLL.png'];
saveas(gcf, fig_name)
movefile(FileSave,FilePath);
movefile(fig_name,FilePath);
end
%close all
But I got exactly the opposite of what I expected
from left to right i value in awgn(test,i); grows
why is this happened?
Have I do some transformation before?
Description says:
out = awgn(in,snr) adds white Gaussian noise to the vector signal in. This syntax assumes that the power of in is 0 dBW.
what is my snr value?

답변 (1개)

Devineni Aslesha
Devineni Aslesha 2020년 6월 26일
Hi Nik,
Here, the snr value increases by 1 dB for every for loop iteration. Since, some userdefined functions are used before saving the test data with added noise, I assume that the test data is being modified after overlaying it with the additive white gaussian noise.
I recommend you to check the reason for the test data being modified. However, plotting the test data after 'test = awgn(test,i);' line gives the correct results i.e. As snr increases, test data is with less noise power.

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by