Guest User

Untitled

a guest
Apr 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. ts = [1 2 3 4 3 2 1 0 -1 -2 -3];
  2. threshold = [-3.5 3];
  3. correction = [1 -1];
  4. for i = 1:numel(ts)
  5. if ts(i) > threshold(2)
  6. ts(i:end) = ts(i:end) + correction(2);
  7. elseif ts(i) < threshold(1)
  8. ts(i:end) = ts(i:end) + correction(1);
  9. end
  10. end
  11. disp(ts)
  12.  
  13. [1 2 3 3 2 1 0 -1 -2 -3 -3]
Add Comment
Please, Sign In to add comment