# Appendix: MATLAB® characters, operators and commands – Matlab® in Bioscience and Biotechnology

Appendix: MATLAB® characters, operators and commands

## Characters, arithmetic, rational and logical operators

 Character, operator Description Page(s) + Addition 6, 19 – Subtraction 6 * Scalar and matrix multiplication 6, 20 .* Element-wise multiplication 28 / Right division 6, 26 \ Left division 6, 26 ./ Element-wise right division 28 .\ Element-wise left division 28 ^ Exponentiation 6 .^ Element-wise exponentiation 28 = Assignment 6 % Percent; use for comments and for output format specification 6, 11 () Parentheses; use for input arguments and in matrix addressing 6, 15, 18 [] Brackets; use for vector, matrix, array elements input 15, 17 (space) Space; separates elements into arrays, and adds into output specifications 15, 18 , Comma; separates elements into arrays, and commands on the same line 6, 15 : Semicolon 6 … Ellipsis 6 < Less than 34 > Greater than 34 <= Less than or equal to 34 >= Greater than or equal to 34 = = Equal 34 ~= Not equal 34 & Logical AND 35 | Logical OR 35 ~ Logical NOT 35

Help and managing commands

 Command Description Page clear Remove variables from the Workspace 10 clc Clear the Command Window 6 close Closes one or more Figure Windows 53 help Displays explanations for commands 7 help graph2d Displays list of 2D graphs 76 help graph3d Displays list of 3D graphs 76 help specgraph Displays list of specialized graph commands 76 doc Displays HTML documentation in the Help window 9 function Creates a new function 100 global Declares a global variable 102 lookfor Search for the word in all help entries 9 ver Displays versions of the MATLAB® products 171 who Displays variables stored in the Workspace 10 whos Displays Workspace variables and additional information about the variables 10

Predefined variables and elementary math functions

 Variable, Function Description Page abs Absolute value 7 ans Last calculated or defined value 8 exp Exponential 7 factorial Factorial function 7 floor Round off toward minus infinity 7 i √–1 10 inf Infinity 10 j The same as i 10 log Natural logarithm 7 log10 Decimal logarithm 7 NaN Not a number 10 pi Number π 7 round Round off toward nearest integer 7 sqrt Square root 7 sin Sine 7 cos Cosine 7 tan Tangent 7 cot Cotangent 7 asin Inverse sine 7 acos Inverse cosine 7 atan Inverse tangent 7 acot Inverse cotangent 7

Relational and logical commands

 Character, command Description Page and Logical AND 35 or Logical OR 35 not Logical NOT 35 find Finds indices of certain elements of array 35

Flow control commands

 Command Description Page(s) else Is used with if 37 elseif conditionally execute if statement condition 37 end Terminates scope of for, while, if statements, or serves as last index 17, 37 for Repeat execution of command/s 37 if Conditionally execute 37 while Repeat execution of command/s 38

Array, matrix, and vector commands

 Command Description Page(s) colon (:) Is used for creating a vector 15 det Calculates a determinant 27 diag Creates a diagonal matrix from a vector 26 eye Creates a unit matrix 22, 26 inv Calculates the inverse matrix 22 length Number of elements in vector 26 reshape Changes size of a matrix 26 linspace Generates a linearly spaced vector 16 max Returns maximal value 27 min Returns minimal value 27 mean Calculates mean value 27 ones Creates an array with ones 25 rand Generates an array with uniformly distributed random numbers 25 randi Generates an array with integer random numbers from uniform discrete distribution 25, 27 randn Generates an array with normally distributed numbers 25 size Size of array/matrix 26 sort Arranges elements in ascending or descending order 27 std Calculates standard deviation 27 strvcat Concatenates strings vertically 26 sum Calculates sum of elements 27 Transpose (') Transposes elements of an array 19 zeros Creates an array with zeros 25

Input, output, display format, and convert commands

 Command Description Page disp Displays output 11 fprintf Displays or saves formatted output 11 input Prompts to user input 99 format Sets current output format 8 num2str Converts numbers to a string 27

Two- and three-dimensional plotting and plot formatting

 Command Description Page axis Controls axis scaling and appearance 57 bar Generates vertical bars on the plot 78 bar3 Generates 3D vertical bars on the plot 78 box, box on/off Adds a box to the current axes, keeps/ removes a box on the axes 68 clabel Labels iso-level lines 78 colormap Sets colors 68 contour Creates a 2D-contour plot 78 contour3 Creates a 3D-contour plot 78 cylinder Generates a cylinder 77 errorbar Creates a plot with error-bounded points 73 figure Creates the Figure window 77 fplot Creates a 2D plot of a function 77 gtext Adds text with the help of the mouse 59 grid Adds grid lines 57 hist Plots a histogram 73 hold on, hold of Keeps current graph open, ends hold on 53 legend Adds a legend to the plot 59 loglog Generates a 2D plot with log axes 77 mesh Creates a 3D plot with meshed surface 66 meshgrid Creates X,Y matrices for further plotting 65 pie Creates a 2D pie plot 79 pie3 Creates a 3D pie plot 79 plot Creates a 2D plot 53 plot3 Creates a 3D plot with points and/or lines 63 polar Creates a 2D plot in polar coordinates 77 polyfit Fits the data by a polynomial 114 polyval Evaluates the polynomial value 114 rotate3d Interactively rotates a 3D plot 72 semilogx Creates a 2D plot with log-scaled x-axis 75 semilogy Creates a 2D plot with log-scaled y-axis 75 sphere Generates a sphere plot 77 stem Creates a 2D stem plot 79 subplot Places multiple plots on the same page 55 surf Creates a 3D surface plot 66 surfc Generates surface and counter plots together 78 text Adds text to the plot 59 title Adds a caption to the plot 59 view Specifies a viewpoint for 3D graph 70 xlabel Adds a label to x-axis 59 ylabel Adds a label to y-axis 59 zlabel Adds a label to z-axis 63

Math functions, integration and differentiation

 Command Description Page diff Calculates a difference, approximates a derivative 110 fzero Solves a one-variable equation 107 interpl One-dimensional interpolation 105 quad Numerical integration with Simpson’s rule 108 trapz Numerical integration with the trapezoidal rule 109

Ordinary and partial equation solvers

 Command Description Page ode15s Solves stiff ODEs 135 ode15i Solves implicit ODEs 135 ode23 Solves non-stiff ODEs 135 ode23s Solves stiff ODEs 135 ode23t Solves stiff ODEs 135 ode23tb Solves stiff ODEs 135 ode45 Solves non-stiff ODEs 135 odell3 Solves non-stiff ODEs 135 odeset Sets ODE options 170 pdepe Solves 1D parabolic and elliptic PDEs 153

Bank access and sequence analysis

 Command Description Page aa2nt Converts a sequence of amino acids to a nucleotide sequence 183 aacount Counts amino acids in a sequence 184 aminolookup Finds amino acid or codon codes 188 basecount Counts nucleotides in sequence 188 baselookup Returns nucleotide codes 188 blastncbi Requests NCBI BLAST report and its ID 181 codoncount Calculates codons in nucleotide sequence 189 dimercount Calculates dimers in nucleotide sequence 189 emblread Reads data stored in EMBL-formatted file 181 genbankread Reads data stored in GenBank-formatted file 178 genpeptread Reads data stored in GenPept-formatted file 180 getblast Gets BLAST report generated in NCBI website 182 getgenbank Gets data from GenBank database 178 getgenpept Gets sequence info from GenPept database 179 getgeodata Gets data in GEO format 180 getembl Gets sequence info from EMBL database 179 getpdb Gets protein 3D data from PDB database 180 molviewer Generates 3D molecule image 181 molweight Calculates molecular weight of amino acids 189 multialign Aligns multiple sequences 194 multialignviewer Displays and interactively adjusts multiple sequence alignment 197 nt2aa Converts nucleotide to amino acid sequence 206 ntdensity Plots nucleotide densities along sequence 186 nwalign Aligns two sequences globally 192 pdbread Reads data stored in PDB-formatted file 181 randseq Generates letter-coded random sequence 183 seqdotplot Generates dot plot for two sequences 194 seqshoworfs Shows open reading frames 184 showalignment Displays results of alignment 196 swalign Aligns two sequences locally 209 web Opens website or file in Web Browser window 175