wrapToInterval()

Version 1.0.2 (150 KB) von Adam Danz
Wraps numeric values to a specified interval.
169 Downloads
Aktualisiert 28. Mär 2021

Lizenz anzeigen

Wrapping numbers to an interval is not difficult and can be done with 1 line of code depending on the interval type. This function adds flexibility to this process by letting the user specify the interval type (open|closed) and by supporting the use of +/-inf in the interval.

xwrap = wrapToInterval(x, [a,b])
wraps values in x to the interval [a,b] resulting in [a <= xwrap < b].

wrapToInterval(x, [a,b], intervalType)
specifies interval type:
------ 'openright' -- results in [a <= xwrap < b]
------ 'openleft' -- results in [a < xwrap <= b]
------ 'closed' -- results in [a <= xwrap <= b]

wrapToInterval(__, plotflag)
produces a scatter plot comparison between x and xwrap.

Also see Matlab's related functions: MOD REM WRAPTOPI WRAPTO2PI WRAPTO180 WRAPTO360

Zitieren als

Adam Danz (2026). wrapToInterval() (https://de.mathworks.com/matlabcentral/fileexchange/89506-wraptointerval), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2021a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Version Veröffentlicht Versionshinweise
1.0.2

Minor format changes to mlx file only.

1.0.1

Updated source URL.

1.0.0