comparison toolboxes/AudioInpaintingToolbox/Utils/evaluation/SNR.m @ 144:19e0af570914 release_1.5

Merge from branch "ivand_dev"
author Ivan <ivan.damnjanovic@eecs.qmul.ac.uk>
date Tue, 26 Jul 2011 15:14:15 +0100
parents 56d719a5fd31
children
comparison
equal deleted inserted replaced
143:8d866d96f006 144:19e0af570914
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