| Contents | Index |
M = mod(X,Y)
M = mod(X,Y) if Y ~= 0, returns X-n.*Y, where n = floor(X./Y). The inputs X and Y must be real arrays of the same size, or either can be a real scalar. For fixed-point or integer input arguments, the output data type is the aggregate type of both input signedness, word lengths, and fraction lengths. For fixed-point inputs, the word length of the internally computed aggregate fixed-point output data type cannot exceed 32 bits. For floating-point input arguments, the output data type is the same as the inputs.
X |
Integer, fixed-point, or floating-point array, or real scalar. |
Y |
Array of the same size as X, or real scalar. |
Calculate the mod of two fi objects.
% 7-bit signed fixed-point object
x = fi(-3,1,7,0);
% 15-bit signed fixed-point object
y = fi(2,1,15,0);
M1 = mod(x,y)
M1 =
1
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 15
FractionLength: 0
M2 = mod(y,x)
M2 =
-1
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 15
FractionLength: 0Convert the fi inputs in the previous example to double type, and calculate the mod.
Mf1 = mod(double(x),double(y))
Mf1 =
1
Mf2 = mod(double(y),double(x))
Mf2 =
-1
Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |