comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Compute Signal-to-Noise Ratio for temperature annealing in mcmc as
4 % described in Neil J. Cornish et al (arXiv:gr-qc/0701167v1).
5 % Returns SNR for each channel.
6 %
7 % - Inputs are -the outputs from both channels
8 % -the inverse cross-spectrum matrix elements
9 % -the template (arXiv:gr-qc/0701167v1)
10 %
11 % Karnesis 24-07-2011
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 function snrexp = stnr(tmplt1,tmplt2,out1,out2,InvS11,InvS22,InvS12,InvS21)
15
16 if tmplt2 == 0
17 hs = 4*real(sum(abs(tmplt1.*(InvS11.*conj(out1)))));
18 hh = 4*real(sum(abs(tmplt1.*(InvS11.*conj(tmplt1)))));
19 snrexp = sqrt(2)*hs/sqrt(hh);
20 else
21 hs1 = 4*real(sum(abs(tmplt1.*(InvS11.*conj(out1) + InvS12.*conj(out2)))));
22 hs2 = 4*real(sum(abs(tmplt2.*(InvS21.*conj(out1) + InvS22.*conj(out2)))));
23
24 hh1 = 4*real(sum(abs(tmplt1.*(InvS11.*conj(tmplt1) + InvS12.*conj(tmplt2)))));
25 hh2 = 4*real(sum(abs(tmplt2.*(InvS21.*conj(tmplt1) + InvS22.*conj(tmplt2)))));
26
27 %snrexp = [sqrt(2)*hs1/sqrt(hh1) sqrt(2)*hs2/sqrt(hh2)];
28 snrexp = sqrt(2)*(hs1+hs2)/sqrt(hh1+hh2);
29
30 end
31
32 end