1 function [v0,v1]=like3(dw,t,stretch)
4 Tmin=stretch(1);Tmax=stretch(2);Tneg=stretch(3);Tpos=stretch(4);
8 % get p0 = data likelhood of 1 as a function of t, p1=derivative
13 p0=max_like*(t>=Tmin & t<=Tmax) + ...
14 (max_like+(t-Tmin)*slope_neg).*(t<Tmin) + ...
15 (max_like+(Tmax-t)*slope_pos).*(t>Tmax);
17 p1= (t<Tmin)*slope_neg - (t>Tmax)*slope_pos;
19 % everything else is derived from that
23 % logp0 = log(1 - p1) = log(1 -exp(logp0))
26 n1=-p1.*exp(p0)./(1-exp(p0)).^2;
28 v0 = dw.*p0.*(dw>0) - dw.*n0.*(dw<0);
29 v1 = dw.*p1.*(dw>0) - dw.*n1.*(dw<0);