annotate _beattracker/dojsdiv2.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function sd = dojsdiv2(pre,post);
matthiasm@8 2
matthiasm@8 3 pre = pre-min(pre);
matthiasm@8 4 post = post-min(post);
matthiasm@8 5 pre = pre(:)';
matthiasm@8 6 post = post(:)';
matthiasm@8 7 pre = pre+eps;
matthiasm@8 8 post = post+eps;
matthiasm@8 9 pre = pre/sum(pre);
matthiasm@8 10
matthiasm@8 11 pi1 = 0.5;
matthiasm@8 12 pi2 = 0.5;
matthiasm@8 13
matthiasm@8 14 % normalise to sum to unity
matthiasm@8 15 pre = pre/(sum(pre)+eps);
matthiasm@8 16 post = post/(sum(post)+eps);
matthiasm@8 17
matthiasm@8 18 % combined distribution
matthiasm@8 19 a1 = pi1*pre + pi2*post;
matthiasm@8 20
matthiasm@8 21 %sd = -sum(a1.*log(a1)) + pi1*sum(pre.*log(pre)) + pi2*sum(post.*log(post));
matthiasm@8 22
matthiasm@8 23
matthiasm@8 24 sd = sum((-a1.*log(a1)) + pi1*(pre.*log(pre)) + pi2*(post.*log(post)));