comparison toolboxes/AudioInpaintingToolbox/Utils/evaluation/SNR.m @ 138:56d719a5fd31 ivand_dev

Audio Inpaintin Toolbox
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Thu, 21 Jul 2011 14:27:47 +0100
parents
children
comparison
equal deleted inserted replaced
137:9207d56c5547 138:56d719a5fd31
1 function snr = SNR(xRef,xEst)
2 % Signal-to-noise Ratio
3 %
4 % Usage: snr = SNR(xRef,xEst)
5 %
6 %
7 % Inputs:
8 % - xRef - reference signal
9 % - xEst - estimate signal
10 %
11 % Outputs:
12 % - snr - SNR
13 %
14 %
15 % -------------------
16 %
17 % Audio Inpainting toolbox
18 % Date: June 28, 2011
19 % By Valentin Emiya, Amir Adler, Maria Jafari
20 % This code is distributed under the terms of the GNU Public License version 3 (http://www.gnu.org/licenses/gpl.txt).
21 % Signal to noise ratio (SNR)
22
23 % Add eps to avoid NaN/Inf values
24 snr = 10*log10((sum(abs(xRef(:)).^2)+eps)/sum((abs(xRef(:)-xEst(:)).^2)+eps));
25
26 return