smooth_theta2.m 249 B

123456789101112
  1. function th=smooth_theta2(acc0,decay)
  2. racc=acc0;
  3. racc(acc0<0)=0;
  4. th=racc(1)*ones(size(racc));
  5. for i=2:numel(racc)
  6. if racc(i)*(1+decay)>th(i-1)
  7. th(i)=racc(i);
  8. else
  9. th(i)=th(i-1)*(1-decay);
  10. end
  11. end