PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/other/Matlab/detection/like3.m

http://github.com/jbeezley/wrf-fire
Objective C | 34 lines | 20 code | 14 blank | 0 comment | 1 complexity | 0049847d298c5efdc6e1cb9853050d14 MD5 | raw file
Possible License(s): AGPL-1.0
  1. function [v0,v1]=like3(dw,t,stretch)
  2. % stretch:
  3. Tmin=stretch(1);Tmax=stretch(2);Tneg=stretch(3);Tpos=stretch(4);
  4. max_like=log(0.9);
  5. % get p0 = data likelhood of 1 as a function of t, p1=derivative
  6. slope_neg=0.5;
  7. slope_pos=0.1;
  8. p0=max_like*(t>=Tmin & t<=Tmax) + ...
  9. (max_like+(t-Tmin)*slope_neg).*(t<Tmin) + ...
  10. (max_like+(Tmax-t)*slope_pos).*(t>Tmax);
  11. p1= (t<Tmin)*slope_neg - (t>Tmax)*slope_pos;
  12. % everything else is derived from that
  13. % p0 + p1 = 1
  14. % p0 = 1 - p1
  15. % logp0 = log(1 - p1) = log(1 -exp(logp0))
  16. n0=log(1-exp(p0));
  17. n1=-p1.*exp(p0)./(1-exp(p0)).^2;
  18. v0 = dw.*p0.*(dw>0) - dw.*n0.*(dw<0);
  19. v1 = dw.*p1.*(dw>0) - dw.*n1.*(dw<0);
  20. end