# Basic operations in labview mathscript

 Page 1 / 1
This module covers basic operations in LabVIEW MathScript.

## Basic operations on numbers

LABVIEW MATHSCRIPT has many arithmetic operations and functions built in. Most of them arestraightforward to use. The Table below lists some commonly used scalar operations; in this table, x and y are scalars. (A scalar is a single number.)

Common scalar mathematical operations in labview mathscript
Operation LABVIEW MATHSCRIPT
$x-y$ x-y
$x+y$ x+y
$xy$ x*y
$\frac{x}{y}$ x/y
$x^{y}$ x^y
$e^{x}$ exp(x)
$\mathrm{log10}(x)$ log10(x)
$\mathrm{ln}(x)$ log(x)
$\mathrm{log2}(x)$ log2(x)

Expressions are formed from numbers, variables, and these operations. The operations have different precedences. The ^ operation has the highest precedence; ^ operations are evaluated before any other operations. Multiplication and division have the next highest precedence, and addition and subtraction have the lowest precedence. Precedence is altered by parentheses; expressions within parenthesesare evaluated before expressions outside parentheses.

The Table below shows several mathematical formulas, the corresponding LABVIEW MATHSCRIPT expressions, and the values that LABVIEW MATHSCRIPT would compute for the expressions.

Example labview mathscript expressions
formula LABVIEW MATHSCRIPT Expression Computed Value
$5^{2}+4^{2}$ 5^2+4^2 41
$(5+4)^{2}$ (5+4)^2 81
$\frac{2+3}{4-5}$ (2 + 3)/(4 - 5) -5
$\mathrm{log10}(100)$ log10(100) 2
$\mathrm{ln}(4(2+3))$ log(4*(2+3)) 2.9957

## Basic operations on matrices

In addition to scalars, LABVIEW MATHSCRIPT can operate on matrices. Some common matrix operations are shown in the Table below; in this table, M and N are matrices.

Common matrix mathematical operations in labview mathscript
Operation LABVIEW MATHSCRIPT
$MN$ M*N
$M^{-1}$ inv(M)
$M^{T}$ M'
det( $M$ ) det(M)

LABVIEW MATHSCRIPT functions length and size are used to find the dimensions of vectors and matrices, respectively.

LABVIEW MATHSCRIPT can perform an operation on each element of a vector or matrix. To perform an arithmetic operation on each element in a vector (or matrix), rather than on the vector (matrix) itself, then the operator should be preceded by".", e.g .* , .^ and ./ .

Let $A=\begin{pmatrix}1 & 1\\ 1 & 1\\ \end{pmatrix}$ . Then A^2 will return $\mathrm{AA}=\begin{pmatrix}2 & 2\\ 2 & 2\\ \end{pmatrix}$ , while A.^2 will return $\begin{pmatrix}1^{2} & 1^{2}\\ 1^{2} & 1^{2}\\ \end{pmatrix}=\begin{pmatrix}1 & 1\\ 1 & 1\\ \end{pmatrix}$ .

Given a vector x, compute a vector y having elements $y(n)=\frac{1}{\sin x(n)}$ . This can be easily be done in LABVIEW MATHSCRIPT by typing y=1./sin(x) Note that using / in place of ./ would result in the (common) error Matrix dimensions must agree .

## Complex numbers

LABVIEW MATHSCRIPT has excellent support for complex numbers with several built-in functions available. The imaginaryunit is denoted by i or (as preferred in electrical engineering) j . To create complex variables ${z}_{1}=7+i$ and ${z}_{2}=2e^{(i\pi )}$ simply enter z1 = 7 + j and z2 = 2*exp(j*pi)

The Table below gives an overview of the basic functions for manipulating complex numbers, where $z$ is a complex number.

Manipulating complex numbers in labview mathscript
LABVIEW MATHSCRIPT
Re( $z$ ) real(z)
Im( $z$ ) imag(z)
$\left|z\right|$ abs(z)
Angle( $z$ ) angle(z)
$z^{*}$ conj(z)

## Other useful details

• A semicolon added at the end of a line tells LABVIEW MATHSCRIPT to suppress the command output to the display.
• LABVIEW MATHSCRIPT Version 1.0 is case sensitive for both variables and functions; for example, b and B are different variables and LABVIEW MATHSCRIPT will recognize the built-in function sum but not SUM . In previous versions, LABVIEW MATHSCRIPT was not case sensitive for function names.
• Often it is useful to split a statement over multiple lines. To split a statement across multiple lines, enter three periods ... at the end of the line to indicate it continues on the next line.

Splitting $y=a+b+c$ over multiple lines. y = a... + b...c;

where we get a research paper on Nano chemistry....?
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
Got questions? Join the online conversation and get instant answers!