view util/snr.m @ 225:f0441ef3ae8f danieleb

Updating this branch in order to reflect the default branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 12 Apr 2012 13:53:23 +0100
parents 88578ec2f94a
children
line wrap: on
line source
function x = snr(s,r)
% SNR calculates the signal-to-noise ratio between the signal s and its
% representation r defined as:
% SNR = 20*log10(||s||_2/||s-r||_2)
err = s-r;
x = mag2db(norm(s(:))/norm(err(:)));