function [adjustedInput] = adjustToBoundaries(inputValue, lowerBoundary, upperBoundary) %ADJUSTTOBOUNDARIES If input data exceeds boundaries, it will received boundary value. % If the input value exceeds the upper or lower limit that is given, the % input data will become the boundary. % % Parameters: % inputValue (number) The value that will be checked. % lowerBoundary (number) The lower boundary. % upperBoundary (number) The upper boundary. %% Initialize return variable adjustedInput = inputValue; %% Check for lower boundary if inputValue < lowerBoundary adjustedInput = lowerBoundary; return; end %% Check for upper boundary if inputValue > upperBoundary adjustedInput = upperBoundary; return; end end