I wanna add (2 dB for example) of noise uncertainty to a given signal x, I tried this way:
S=10*log10(var(x));
N=S-SNR;
n1=randn(1,round(length(x)/4));
n1=n1-mean(n1);
n1=n1/std(n1)*sqrt(10^(N/10));
n2=randn(1,round(length(x)/4));
n2=n2-mean(n2);
n2=n2/std(n2)*sqrt(10^((N+1)/10));
n3=randn(1,round(length(x)/4));
n3=n3-mean(n3);
n3=n3/std(n3)*sqrt(10^(N/10));
n4=randn(1,length(sf)-3*length(n1));
n4=n4-mean(n4);
n4=n4/std(n4)*sqrt(10^((N+2)/10));
n=[n1 n2 n3 n4];
I assumed that the vector "n" will add a 2 dB of uncertainty to the clean signal x to produce y as follow:
y=x+n;
Is that the right way to add uncertainty?
Best