1. 程式人生 > 其它 >信噪比計算公式_什麼是信噪比SNR

信噪比計算公式_什麼是信噪比SNR

技術標籤:信噪比計算公式

  1. 什麼是信噪比SNR?

    SNR的定義在 胡廣書《數字訊號處理理論、演算法與實現(第三版)》(清華大學出版社)第20頁有寫。

    CSDN上一篇blog也進行了詳細講述:

    https://blog.csdn.net/u012995500/article/details/87606346

具體說來包含幾個要點:

(1)白噪聲的功率用其方差來定義

(2)離散訊號的功率可以使用公式:

a78881c64c77d454bc9842748cb75b40.png

(3)信噪比SNR計算公式為:

46910aaea9413997ca9d63307332ac59.png

2. MATLAB程式碼如下:

function y = add_gaussian_noise_snr_db(signal, snr)x = signal(:)';power_of_signal = (x*x')/length(x);power_of_noise = power_of_signal/(10^(snr/10)); % the std of the noise is the power of the noisenoise0 = randn(size(x));noise1 = (noise0 - mean(noise0))/std(noise0 - mean(noise0));y = sqrt(power_of_noise)*noise1+ x;end