Mercurial > hg > smallbox
diff util/snr.m @ 162:88578ec2f94a danieleb
Updated grassmannian function and minor debugs
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Wed, 31 Aug 2011 13:52:23 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/util/snr.m Wed Aug 31 13:52:23 2011 +0100 @@ -0,0 +1,6 @@ +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(:))); \ No newline at end of file