Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

mod

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Finds the modulus after division.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = mod(x,y);

Returns x - n*y where n = floor(x/y) if y is not equal to 0. The input x can be a real array or a real scalar, while y must be a real scalar.

The following are true by convention:

mod(x,0) = x

mod(x,x) = 0

 

Example

Find the modulus of a matrix after dividing each element by a scalar:

?A=[1,2;3,4];

?mod(A,2);

result: 

1  2  

3  4  

result: 

1  0  

1  0

 

See Also

Functions, floor, ceil

Copyright Lumerical Inc. | Privacy | Site Map