annotate toolboxes/AudioInpaintingToolbox/Utils/evaluation/SNR.m @ 161:f42aa8bcb82f ivand_dev

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