1 function sequence = maxUnwrap(sequence, max) 2 % 3 % sequence = maxUnwrap(sequence, max) 4 % Unwraps when a wrap around is detected. 5 % 6 % Arguments 7 % 8 % sequence: The vector to unwrap. 9 % max: The maximum value that the sequence can take, 10 % and after which it will wrap over to 0. 11 % 12 % Return value 13 % 14 % sequence: The unwrapped vector. 15 % 16 17 % Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 18 % 19 % Use of this source code is governed by a BSD-style license 20 % that can be found in the LICENSE file in the root of the source 21 % tree. An additional intellectual property rights grant can be found 22 % in the file PATENTS. All contributing project authors may 23 % be found in the AUTHORS file in the root of the source tree. 24 25 sequence = round((unwrap(2 * pi * sequence / max) * max) / (2 * pi)); 26