Please enable JavaScript to view this site.

Knowledge Base

Standard mathematical and matrix functions are listed in this page. Users have also the option to define their own custom functions using user defined functions

 

Trigonometric and complex

Command

Description

sin

Trigonometric sin function.

cos

Trigonometric cos function.

tan

Trigonometric tan function.

asin

Inverse trigonometric sin function.

acos

Inverse trigonometric cos function.

atan

Inverse trigonometric tan function.

atan2

Same as atan, but returns angle in correct quadrant.

real

Returns the real part of variable

imag

Returns the imaginary part of variable

conj

Complex conjugate

abs

Absolute value

angle

Phase of a complex number.

unwrap

Removes phase difference of more than 2π.

 

Logarithmic, exponential and power

Command

Description

log

The natural logarithm. Input can be complex or negative.

log10

The log, base 10. Input can be complex or negative.

sqrt

The square root.

exp

The exponential.

 

Matrix functions

Command

Description

size

Returns the dimensions of a matrix.

length

Returns the total number of elements in a matrix.

pinch

Remove singleton dimensions from a matrix.

sum

The sum of a matrix.

prod

The product of elements in a matrix.

max

The max value in a matrix.

min

The min value in a matrix.

amax

The maximum value in a specified dimension of a matrix.

amin

The minimum value in a specified dimension of a matrix.

dot

The dot product of two vectors.

cross

The cross product of two vectors.

flip

Flip a matrix in one dimension.

interp

Linear interpolation function.

spline

Cubic spline interpolation.

polyfit

Polynomial fit.

normpdf

Evaluate the normal (Gaussian) probability density function (PDF)

pearson4pdf

Evaluate the Pearson IV probability density function (PDF)

fitnormpdf

Fit to the normal (Gaussian) probability density function (PDF)

fitpearson4pdf

Fit to the Pearson IV probability density function (PDF)

integrate

Integrate a matrix.

integrate2

Integrate a matrix, ignore singleton dimensions.

find

Find values that satisfy a condition in a matrix.

findpeaks

Find peaks in a matrix.

findresonances

Find the frequency, decay constant and Q-factor of resonances extracted from the time trace of a signal.

transpose

Transpose a matrix.

ctranspose

Transpose a matrix, and do complex conjugate.

mult

Perform matrix multiplication of two or more matrices.

reshape

Reshape the matrix to have different dimensions conserving the overall product of the dimensions.

eig

Calculate the eigenvalues and/or eigenvectors of a matrix.

permute

Rearrange the dimensions of a matrix.

inv

Calculate the inverse of a matrix.

mean

Return the mean value of a matrix.

var

Returns the variance.

std

Returns the standard deviance.

mapfind

Returns a string value associated to specified point, given a file containing a map of values to a string.

svd

Returns a 3-cell array for the decomposition.

chol

Returns the lower triangular matrix.

norm

Returns the matrix y to the L2-norm.

cov

Calculates the covariance matrix.

corrcoef

Calculates the correlation matrix.

scorrcoef

Generates a spatial correlation matrix.

corrtransf

Calculates the transformation matrix.

chpts

Samples function on a Chebyshev grid.

chebin

Returns Chebyshev interpolation of a sampled function.

chebpol

Chebpol is similar to chebin command, but it offers additional control over the interpolation process as it allows to specify the polynomial order.

chebpol1

Returns the first derivative of Chebyshev polynomials of a function sampled on the Chebyshev grid.

sort

Sorts a matrix in ascending or descending order.

sortmap

Sorts matrices in more complex ways than simply ascending or descending order of the array.

conv2

Convolves two 2-dimensional arrays.

 

See also

Manipulating variables

 

String functions

Command

Description

num2str

Convert number to a string.

str2num

Convert a string into a floating point number.

eval

Execute string containing Lumerical scripting language.

feval

Run a Lumerical script file.

length

Returns the total length of the string.

substring

Returns a substring of a string, as a specified position and length.

findstring

Returns the position of a substring in a string.

replace

Replaces a part of a string with another, at a specified position.

replacestring

Replaces all instances of a substring with another string.

splitstring

Split a single long string into a cell (string) array based on a delimiting character.

upper

Convert a string to upper case.

lower

Convert a string to lower case.

toscript

Returns a string containing the equivalent script of a generate variable.

 

Frequency and time-domain

Command

Description

fft

Fast Fourier transform.

fftw

Returns the angular frequency vector.

fftk

Returns the spatial wavevector kx.

invfft

Inverse fft.

czt

Chirped z-transform.

sroughness

Returns a matrix containing a rough surface characterized by an RMS amplitude.

 

Line and polygon functions

Command

Description

polyarea

Returns the area of a polygon.

centroid

Returns the center of mass of a polygon.

polyintersect

Determines if two polygons intersect.

inpoly

Determines if a series of points are inside our outside a polygon.

polygrow

Grows or shrinks a polygon by a specified amount.

polyand

Combines two polygons into one with an and operation.

polyor

Combines two polygons into one with an or operation.

polydiff

Combines two polygons into one by taking the difference.

polyxor

Combines two polygons into one with a xor operation.

lineintersect

Returns the intersection of line segments.

linecross

Determines if line segments cross each other.

 

Colorimetry

Command

Description

colormatchfunction

Returns a set of color matching functions.

colormatch

Calculates the X, Y, Z tristimulus values for a set of color matching functions.

colormatchxy

Calculates the x, y chromaticity values for a set of color matching functions.

colormatchuv

Calculates the u, v chromaticity values for a set of color matching functions.

 

Multilayer stack calculations

Command

Description

stackrt

Calculates the reflection and transmission of a plane wave through a multi-layer stack using the analytic transfer matrix method.

stackfield

Calculates the fields within a multilayer stack illuminated from below by a plane wave using the analytic transfer matrix method.

stackdipole

Analytically calculates the dipole emission for a multilayer stack.

 

Multi-quantum well calculations

Command

Description

mqwgain

Calculates gain and spontaneous emission in multiple quantum well structures

buildmqwmaterial

Returns material properties of the type and format required by mqwgain

 

Ion implant doping calculations

Command

Description

implantrange

Calculates the range of the doping profile from ion implant.

implantstraggle

Calculates the straggle of the doping profile from ion implant.

implantskewness

Calculates the skewness of the doping profile from ion implant.

implantkurtosis

Calculates the kurtosis of the doping profile from ion implant.

implantlateralscatter

Calculates the lateral scatter of the doping profile from ion implant.

 

 

Miscellaneous

Command

Description

ceil

Round up.

floor

Round down.

mod

Modulus after division.

round

Rounds to the nearest integer.

rand

Returns a uniformly distributed random number between 0 and 1.

lognrnd

Returns a lognormal distributed random number.

randn

Returns a normally distributed random number.

randreset

Resets the random number seed.

finite

Determines if a number is finite or NaN.

solar

Returns the solar power spectrum

all

Returns 1 if all of the specified matrix entries are nonzero and returns 0 otherwise.

any

Returns 1 if any of the specified matrix entries are nonzero and returns 0 otherwise.

interptri

Interpolates a data set from a triangular to a rectilinear grid.

interptet

Interpolates a data set in 3D from a tetrahedral to a rectangular grid.

quadtri

Returns approximated integration (first order quadrature) of data on a 2D finite element mesh.

quadtet

Returns approximated integration of data on a 3D finite element mesh.

precision

Returns truncated value to a user specified precision.

erf

Returns the error function.

erfc

Returns the complementary error function.

erfinv

Returns the inverse error function.

erfcinv

Returns the inverse complementary error function.

unique

Returns an array containing all unique values in a given matrix.

uniquevertices

Given a matrix of vertices, returns a matrix of unique vertices with differences in values larger than a specified tolerance.

icht

Takes the Chebyshev interpolation coefficients and returns the corresponding function samples

dcht

Returns the Chebyshev interpolation coefficients

besselj

Bessel function of the first kind

bessely

Bessel function of the second kind

besseli

Modified Bessel function of the first kind

besselk

Modified Bessel function of the second kind

mie3d

Analytically calculates scattering, absorption, and extinction coefficients of a spherical particle.

mie3ds12

Analytically calculates scattered farfield functions of a spherical particle.





Copyright Lumerical Inc. | Privacy | Site Map