Code covered by the BSD License  

Highlights from
A Numerical Tour of Signal Processing

from A Numerical Tour of Signal Processing by Gabriel Peyre
A set of Matlab experiments that illustrates advanced computational signal and image processing.

snr(x,y)
function v = snr(x,y)

% snr - signal to noise ratio
%
%   v = snr(x,y);
%
% v = 20*log10( norm(x(:)) / norm(x(:)-y(:)) )
%
%   x is the original clean signal (reference).
%   y is the denoised signal.
% 
%   Copyright (c) 2008 Gabriel Peyre

v = 20*log10(norm(x(:))/norm(x(:)-y(:)));

Contact us at files@mathworks.com