Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ts = [1 2 3 4 3 2 1 0 -1 -2 -3];
- threshold = [-3.5 3];
- correction = [1 -1];
- for i = 1:numel(ts)
- if ts(i) > threshold(2)
- ts(i:end) = ts(i:end) + correction(2);
- elseif ts(i) < threshold(1)
- ts(i:end) = ts(i:end) + correction(1);
- end
- end
- disp(ts)
- [1 2 3 3 2 1 0 -1 -2 -3 -3]
Add Comment
Please, Sign In to add comment