%% Remainder After Division for Positive and Negative Values
% Find the remainder after division for a set of integers including both positive and negative values. Note that nonzero results are always positive if the divisor is positive.

a = [-4 -1 7 9];
m = 3;
b = mod(a,m)

% Copyright 2012 The MathWorks, Inc.