有关信噪比的一个问题
大家帮忙看看,我前面设的SNR=2,但是随后用两个比较成熟的公式计算的结果都是6.17,按matlab中的说明,也应该是4吧,这是怎么回事?公式用错了,还是我对wnoise函数理解的有问题?附1:代码
%测试数据的选取
= wnoise(3,11,snr,init);%generate the signal containing 2^11 dots.,x is the origin singnal and signal is the noising signal.
s=signal;
N=2^11;
wname='db7';
jN=2;%分解的尺度
=wavedec(s,jN,wname);
snr1=20*log10(norm(x)/norm(s-x));
Ps=sum((x).^2);%signal power
Pn=sum((x-signal).^2);%noise power
snr2=10*log10(Ps/Pn);
p1=1/length(x)*norm(x)^2;
p2=1/length(x)*norm(x-signal)^2;
snr3=10*log10(p1/p2)
附2:matlab中 wnoise()函数的说明:
X = wnoise(FUN,N) returns values of the test signal given by FUN, on a 2N grid of .
= wnoise(FUN,N,SQRT_SNR) returns a test vector X as above, rescaled such that std(X) = SQRT_SNR. The returned vector XN contains the same test vector corrupted by additive Gaussian white noise N(0,1). Then, XN has a signal-to-noise ratio of SNR = (SQRT_SNR)2.
页:
[1]