diff m-toolbox/classes/+utils/@math/stnr.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@math/stnr.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,32 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Compute Signal-to-Noise Ratio for temperature annealing in mcmc as  
+% described in Neil J. Cornish et al (arXiv:gr-qc/0701167v1).
+% Returns SNR for each channel.
+%
+% - Inputs are -the outputs from both channels
+%              -the inverse cross-spectrum matrix elements
+%              -the template (arXiv:gr-qc/0701167v1)
+% 
+% Karnesis 24-07-2011
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+function snrexp = stnr(tmplt1,tmplt2,out1,out2,InvS11,InvS22,InvS12,InvS21)
+
+ if tmplt2 == 0 
+   hs = 4*real(sum(abs(tmplt1.*(InvS11.*conj(out1)))));
+   hh = 4*real(sum(abs(tmplt1.*(InvS11.*conj(tmplt1)))));
+   snrexp = sqrt(2)*hs/sqrt(hh);     
+ else
+   hs1 = 4*real(sum(abs(tmplt1.*(InvS11.*conj(out1) + InvS12.*conj(out2)))));
+   hs2 = 4*real(sum(abs(tmplt2.*(InvS21.*conj(out1) + InvS22.*conj(out2)))));
+ 
+   hh1 = 4*real(sum(abs(tmplt1.*(InvS11.*conj(tmplt1) + InvS12.*conj(tmplt2)))));
+   hh2 = 4*real(sum(abs(tmplt2.*(InvS21.*conj(tmplt1) + InvS22.*conj(tmplt2)))));
+
+   %snrexp = [sqrt(2)*hs1/sqrt(hh1) sqrt(2)*hs2/sqrt(hh2)];
+   snrexp = sqrt(2)*(hs1+hs2)/sqrt(hh1+hh2);
+ 
+ end
+ 
+end
\ No newline at end of file