Mercurial > hg > smallbox
annotate util/snr.m @ 170:68fb71aa5339 danieleb
Added dictionary decorrelation functions and test script for Letters paper.
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Thu, 06 Oct 2011 14:33:41 +0100 |
parents | 88578ec2f94a |
children |
rev | line source |
---|---|
daniele@162 | 1 function x = snr(s,r) |
daniele@162 | 2 % SNR calculates the signal-to-noise ratio between the signal s and its |
daniele@162 | 3 % representation r defined as: |
daniele@162 | 4 % SNR = 20*log10(||s||_2/||s-r||_2) |
daniele@162 | 5 err = s-r; |
daniele@162 | 6 x = mag2db(norm(s(:))/norm(err(:))); |