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

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

% Copyright 2012 The MathWorks, Inc.