PageRenderTime 41ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/other/Matlab/detection/like1.m

http://github.com/jbeezley/wrf-fire
Objective C | 33 lines | 23 code | 10 blank | 0 comment | 3 complexity | b383fe20dc67fbdad0bd525771bb4588 MD5 | raw file
Possible License(s): AGPL-1.0
  1. function [v0,v1]=like1(dw,t,stretch)
  2. % [v0,v1]=like1(dw,t,stretch)
  3. % dw > 0 if fire detected, <0 if not, 0 if cloud
  4. % t = time since fire arrival (days)
  5. Tmin=stretch(1);Tmax=stretch(2);Tneg=stretch(3);Tpos=stretch(4);
  6. tneg = (t-Tmin)./Tneg;
  7. tpos = (t-Tmax)./Tpos;
  8. v0y = -tneg.*tneg.*(t<Tmin)-tpos.*tpos.*(t>Tmax);
  9. g0 = @(x) -0.25.*x.*x.*x+0.75*x-0.5;
  10. % v0n1 = (t<Tmin-2*Tneg);
  11. v0n2 = g0(-tneg-1).*(Tmin-2*Tneg<=t & t<=Tmin);
  12. v0n3 = - (Tmin < t & t<Tmax);
  13. v0n4 = g0(tpos-1).*(Tmax <= t & t <= Tmax+2*Tpos);
  14. % v0n5 = (t>Tmax+2*Tpos);
  15. % v0n = v0n1 + v0n2 + v0n3 + v0n4 + v0n5;
  16. v0n = v0n2 + v0n3 + v0n4 ;
  17. v0 = -dw.*(dw<0).*v0n + dw.*(dw>0).*v0y;
  18. v1y = -2.*tneg.*(t<Tmin)-2.*tpos.*(t>Tmax);
  19. g1 = @(x) -1.5*x.*x+1.5;
  20. v1n = - g1(-tneg-1).*(Tmin-2*Tneg<=t & t<=Tmin) ...
  21. + g1(tpos-1).*(Tmax <= t & t <= Tmax+2*Tpos);
  22. v1 = -dw.*(dw<0).*v1n + dw.*(dw>0).*v1y;
  23. end