SlideShare a Scribd company logo
MATLAB Commands – 1
MATLAB Commands and Functions
Dr. Brian Vick
Mechanical Engineering Department
Virginia Tech
General Purpose Commands
Operators and Special Characters / 3
Commands for Managing a Session / 3
Special Variables and Constants / 4
System and File Commands / 4
Input/Output and Formatting Commands
Input/Output Commands / 5
Format Codes for fprintf and fscanf / 5
Numeric Display Formats / 5
Vector, Matrix and Array Commands
Array Commands / 6
Special Matrices / 6
Matrix Arithmetic / 6
Matrix Commands for Solving Linear Equations / 6
Cell Array Functions / 7
Structure Functions / 7
Plotting Commands
Basic xy Plotting Commands / 8
Plot Enhancement Commands / 8
Specialized Plot Commands / 8
Colors, Symbols and Line Types / 9
Three-Dimensional Plotting Commands / 9
Histogram Functions / 9
MATLAB Commands – 2
Programming
Logical and Relational Operators / 10
Program Flow Control / 10
Logical Functions / 10
M-Files / 11
Timing /11
Mathematical Functions
Exponential and Logarithmic Functions / 12
Trigonometric Functions / 12
Hyperbolic Functions / 12
Complex Functions / 13
Statistical Functions / 13
Random Number Functions / 13
Numeric Functions / 13
String Functions / 13
Numerical Methods
Polynomial and Regression Functions / 14
Interpolation Functions / 14
Numerical Integration Functions / 14
Numerical Differentiation Functions / 14
ODE Solvers / 15
Predefined Input Functions / 15
Symbolic Math Toolbox
Functions for Creating and Evaluating Symbolic Expressions / 16
Functions for Manipulating Symbolic Expressions / 16
Symbolic Calculus Functions / 16
Symbolic Solution of Algebraic and Transcendental Equations / 17
Symbolic Solution of Differential Equations / 17
Laplace Transform Functions / 17
Symbolic Linear Algebra Functions / 17
MATLAB Commands – 3
General Purpose Commands
Operators and Special Characters
+ Plus; addition operator.
- Minus; subtraction operator.
* Scalar and matrix multiplication operator.
.* Array multiplication operator.
^ Scalar and matrix exponentiation operator.
.^ Array exponentiation operator.
 Left-division operator.
/ Right-division operator.
. Array left-division operator.
./ Array right-division operator.
: Colon; generates regularly spaced elements and represents an entire row or column.
( ) Parentheses; encloses function arguments and array indices; overrides precedence.
[ ] Brackets; enclosures array elements.
. Decimal point.
… Ellipsis; line-continuation operator.
, Comma; separates statements and elements in a row.
; Semicolon; separates columns and suppresses display.
% Percent sign; designates a comment and specifies formatting.
_ Quote sign and transpose operator.
._ Nonconjugated transpose operator.
= Assignment (replacement) operator.
Commands for Managing a Session
clc Clears Command window.
clear Removes variables from memory.
exist Checks for existence of file or variable.
global Declares variables to be global.
help Searches for a help topic.
lookfor Searches help entries for a keyword.
quit Stops MATLAB.
who Lists current variables.
whos Lists current variables (long display).
MATLAB Commands – 4
Special Variables and Constants
ans Most recent answer.
eps Accuracy of floating-point precision.
i,j The imaginary unit .1-
Inf Infinity.
NaN Undefined numerical result (not a number).
pi The number p .
System and File Commands
cd Changes current directory.
date Displays current date.
delete Deletes a file.
diary Switches on/off diary file recording.
dir Lists all files in current directory.
load Loads workspace variables from a file.
path Displays search path.
pwd Displays current directory.
save Saves workspace variables in a file.
type Displays contents of a file.
what Lists all MATLAB files in the current directory.
wklread Reads .wk1 spreadsheet file.
MATLAB Commands – 5
Input/Output and Formatting Commands
Input/Output Commands
disp Displays contents of an array or string.
fscanf Read formatted data from a file.
format Controls screen-display format.
fprintf Performs formatted writes to screen or file.
input Displays prompts and waits for input.
; Suppresses screen printing.
Format Codes for fprintf and fscanf
%s Format as a string.
%d Format as an integer.
%f Format as a floating point value.
%e Format as a floating point value in scientific notation.
%g Format in the most compact form: %f or %e.
n Insert a new line in the output string.
t Insert a tab in the output string.
Numeric Display Formats
format short Four decimal digits (default).
format long 16 decimal digits.
format short e Five digits plus exponent.
format long e 16 digits plus exponents.
format bank Two decimal digits.
format + Positive, negative, or zero.
format rat Rational approximation.
format compact Suppresses some line feeds.
format loose Resets to less compact display mode.
MATLAB Commands – 6
Vector, Matrix and Array Commands
Array Commands
cat Concatenates arrays.
find Finds indices of nonzero elements.
length Computers number of elements.
linspace Creates regularly spaced vector.
logspace Creates logarithmically spaced vector.
max Returns largest element.
min Returns smallest element.
prod Product of each column.
reshape Change size
size Computes array size.
sort Sorts each column.
sum Sums each column.
Special Matrices
eye Creates an identity matrix.
ones Creates an array of ones.
zeros Creates an array of zeros.
Matrix Arithmetic
cross Computes cross products.
dot Computes dot products.
Matrix Commands for Solving Linear Equations
det Computes determinant of an array.
inv Computes inverse of a matrix.
pinv Computes pseudoinverse of a matrix.
rank Computes rank of a matrix.
rref Computes reduced row echelon form.
MATLAB Commands – 7
Cell Array Functions
cell Creates cell array.
celldisp Displays cell array.
cellplot Displays graphical representation of cell array.
num2cell Converts numeric array to cell array.
deal Matches input and output lists.
iscell Identifies cell array.
Structure Functions
fieldnames Returns field names in a structure array.
getfield Returns field contents of a structure array.
isfield Identifies a structure array field.
isstruct Identifies a structure array.
rmfield Removes a field from a structure array.
setfield Sets contents of field.
struct Creates structure array.
MATLAB Commands – 8
Plotting Commands
Basic xy Plotting Commands
axis Sets axis limits.
fplot Intelligent plotting of functions.
grid Displays gridlines.
plot Generates xy plot.
print Prints plot or saves plot to a file
title Puts text at top of plot.
xlabel Adds text label to x-axis.
ylabel Adds text label to y-axis.
Plot Enhancement Commands
axes Creates axes objects.
close Closes the current plot.
close all Closes all plots.
figure Opens a new figure window.
gtext Enables label placement by mouse.
hold Freezes current plot.
legend Legend placement by mouse.
refresh Redraws current figure window.
set Specifies properties of objects such as axes.
subplot Creates plots in subwindows.
text Places string in figure.
Specialized Plot Commands
bar Creates bar chart.
loglog Creates log-log plot.
polar Creates polar plot.
semilogx Creates semilog plot (logarithmic abscissa).
semilogy Creates semilog plot (logarithmic ordinate).
stairs Creates stairs pot.
stem Creates stem plot.
MATLAB Commands – 9
Colors, Symbols and Line Types
Color Symbol Line
y yellow . point - solid
m magenta o circle : dotted
c cyan x x-mark -. dash dotted
r red + plus -- dashed
g green * star
b blue d diamond
w white v triangle (down)
k black ^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram
Three-Dimensional Plotting Commands
contour Creates contour plot.
mesh Creates three-dimensional mesh surface plot.
meshc Same as mesh with contour plot underneath.
meshz Same as mesh with vertical lines underneath.
plot3 Creates three-dimensional plots from lines and points.
surf Creates shaded three-dimensional mesh surface plot.
surfc Same as surf with contour plot underneath.
meshgrid Creates rectangular grid.
waterfall Same as mesh with mesh lines in one direction.
zlabel Adds text label to z-axis.
Histogram Functions
bar Creates a bar chart.
hist Aggregates the data into equally spaced bins.
histc Aggregates the data into unequally spaced bins.
MATLAB Commands – 10
Programming
Logical and Relational Operators
== Relational operator: equal to.
~= Relational operator: not equal to.
< Relational operator: less than.
<= Relational operator: less than or equal to.
> Relational operator: greater than.
>= Relational operator: greater than or equal to.
& Logical operator: AND.
| Logical operator: OR.
~ Logical operator: NOT.
xor Logical operator: EXCLUSIVE OR.
Program Flow Control
break Terminates execution of a loop.
case Provides alternate execution paths within switch structure.
else Delineates alternate block of statements.
elseif Conditionally executes statements.
end Terminates for, while, and if statements.
error Display error messages.
for Repeats statements a specific number of times
if Executes statements conditionally.
otherwise Default part of switch statement.
return Return to the invoking function.
switch Directs program execution by comparing point with case expressions.
warning Display a warning message.
while Repeats statements an indefinite number of times.
Logical Functions
any True if any elements are nonzero.
all True if all elements are nonzero.
find Finds indices of nonzero elements.
finite True if elements are finite.
isnan True if elements are undefined.
isinf True if elements are infinite.
isempty True if matrix is empty.
isreal True if all elements are real.
MATLAB Commands – 11
M-Files
eval Interpret strings containing Matlab expressions.
feval Function evaluation.
function Creates a user-defined function M-file.
global Define global variables.
nargin Number of function input arguments.
nargout Number of function output arguments.
script Script M-files
Timing
cputime CPU time in seconds.
clock Current date and time as date vector.
tic, toc Start, stop a stopwatch timer.
MATLAB Commands – 12
Mathematical Functions
Exponential and Logarithmic Functions
exp(x) Exponential; ex
.
log(x) Natural logarithm; ln(x).
log10(x) Common (base 10) logarithm; log(x)= log10(x).
sqrt(x) Square root; .x
Trigonometric Functions
acos(x) Inverse cosine; arcos x = cos –1
(x).
acot(x) Inverse cotangent; arccot x = cot –1
(x).
acsc(x) Inverse cosecant; arcs x = csc –1
(x).
asec(x) Inverse secant; arcsec x = sec –1
(x).
asin(x) Inverse sine; arcsin x = sin –1
(x).
atan(x) Inverse tangent; arctan x = tan –1
(x).
atan2(y,x) Four-quadrant inverse tangent.
cos(x) Cosine; cos(x).
cot(x) Cotangent; cot(x).
csc(x) Cosecant; csc(x).
sec(x) Secant; sec(x).
sin(x) Sine; sin(x).
tan(x) Tangent; tan(x).
Hyperbolic Functions
acosh(x) Inverse hyperbolic cosine; cosh –1
(x).
acoth(x) Inverse hyperbolic cotangent; coth –1
(x).
acsch(x) Inverse hyperbolic cosecant; csch –1
(x).
asech(x) Inverse hyperbolic secant; sech –1
(x).
asinh(x) Inverse hyperbolic sine; sinh –1
(x).
atanh(x) Inverse hyperbolic tangent; tanh –1
(x).
cosh(x) Hyperbolic cosine; cosh(x).
coth(x) Hyperbolic cotangent; cosh(x)/sinh(x).
csch(x) Hyperbolic cosecant; 1/sinh(x).
sech(x) Hyperbolic secant; 1/cosh(x).
sinh(x) Hyperbolic sine; sinh(x).
tanh(x) Hyperbolic tangent; sinh(x)/cosh(x).
MATLAB Commands – 13
Complex Functions
abs(x) Absolute value; |x|.
angle(x) Angle of a complex number x.
conj(x) Complex conjugate of x.
imag(x) Imaginary part of a complex number x.
real(x) Real part of a complex number x.
Statistical Functions
erf(x) Computes the error function erf (x).
mean Calculates the average.
median Calculates the median.
std Calculates the standard deviation.
Random Number Functions
rand Generates uniformly distributed random numbers between 0 and 1.
randn Generates normally distributed random numbers.
Numeric Functions
ceil Rounds to the nearest integer toward •.
fix Rounds to the nearest integer toward zero.
floor Rounds to the nearest integer toward - •.
round Rounds towards the nearest integer.
sign Signum function.
String Functions
findstr Finds occurrences of a string.
strcmp Compares strings.
char Creates character string array
MATLAB Commands – 14
Numerical Methods
Polynomial and Regression Functions
conv Computes product of two polynomials
deconv Computes ratio of polynomials.
eig Computes the eigenvalues of a matrix.
poly Computes polynomial from roots.
polyfit Fits a polynomial to data.
polyval Evaluates polynomial and generates error estimates.
roots Computes polynomial roots.
Interpolation Functions
interp1 Linear and cubic-spline interpolations of a function of one variable.
interp2 Linear interpolation of a function of two variables.
spline Cubic-spline interpolation.
unmkpp Computes the coefficients of cubic-spine polynomials.
Root Finding and Minimization
fmin Finds minimum of single-variable function.
fmins Finds minimum of multivariable function.
fzero Finds zero of single-variable function.
Numerical Integration Functions
quad Numerical integration with adaptive Simpson’s rule.
quadl Numerical integration with adaptive Lobatto quadrature.
trapz Numerical integration with the trapezoidal rule.
Numerical Differentiation Functions
diff(x) Computes the difference between adjacent elements in the vector x.
polyder Differentiates a polynomial, a polynomial product, or a polynomial quotient.
MATLAB Commands – 15
ODE Solvers
ode23 Nonstiff, low-order solver.
ode45 Nonstiff, medium-order solver.
ode113 Nonstiff, variable-order solver.
ode23s Stiff, low-order.
ode23t Moderately stiff, trapezoidal rule solver.
ode23b Stiff, low-order solver.
ode15s Stiff, variable-order solver.
odeset Creates integrator options structure for ODE solvers.
Predefined Input Functions
gensig Generates a periodic sine, square, or pulse input.
sawtooth Generates a periodic sawtooth input.
square Generates a square wave input.
stepfun Generates a step function input.
MATLAB Commands – 16
Symbolic Math Toolbox
Functions for Creating and Evaluating Symbolic Expressions
class Returns the class of an expression.
digits Sets the number of decimal digits used to do variable precision arithmetic.
double Converts an expression to numeric form.
ezplot Generates a plot of a symbolic expression.
findsym Finds the symbolic variables in a symbolic expression.
numden Returns the numerator and denominator of an expression.
sym Creates a symbolic variable.
syms Creates one or more symbolic variables.
vpa Sets the number of digits used to evaluate expressions.
Functions for Manipulating Symbolic Expressions
collect Collects coefficients of like powers in an expression.
expand Expands an expression by carrying out jpowers.
factor Factors an expression.
poly2sym Converts a polynomial coefficient vector to a symbolic polynomial.
pretty Displays an expression in a form that resembles typeset mathematics.
simple Searches for the shortest form of an expression.
simplify Simplifies an expression using Maple’s simplification rules.
subs Substitutes variables or expressions.
sym2poly Converts an expression to a polynomial coefficient vector.
Symbolic Calculus Functions
diff Returns the derivative of an expression.
Dirac Dirac delta function (unit impulse).
Heaviside Heaviside function (unit step).
int Returns the integral of an expression.
limit Returns the limit of an expression.
symsum Returns the symbolic summation of an expression.
taylor Returns the Taylor series of a function.
MATLAB Commands – 17
Symbolic Solution of Algebraic and Transcendental Equations
solve Solves symbolic equations.
Symbolic Solution of Differential Equations
dsolve Returns a symbolic solution of a differential equation or set of equations.
Laplace Transform Functions
ilaplace Returns the inverse Laplace transform.
laplace Returns the Laplace transform.
Symbolic Linear Algebra Functions
det Returns the determinant of a matrix.
eig Returns the eigenvalues (characteristic roots) of a matrix.
inv Returns the inverse of a matrix.
poly Returns the characteristic polynomial of a matrix.
Ad

More Related Content

What's hot (20)

User defined functions in matlab
User defined functions in  matlabUser defined functions in  matlab
User defined functions in matlab
Infinity Tech Solutions
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Santosh V
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Ameen San
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab Functions
Umer Azeem
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
Alamgir Hossain
 
Fourier transforms
Fourier transforms Fourier transforms
Fourier transforms
Fahad B. Mostafa
 
Loops in matlab
Loops in matlabLoops in matlab
Loops in matlab
TUOS-Sam
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
Muhammad Rizwan
 
Applications Of Laplace Transforms
Applications Of Laplace TransformsApplications Of Laplace Transforms
Applications Of Laplace Transforms
Ketaki_Pattani
 
Laplace Transform and its applications
Laplace Transform and its applicationsLaplace Transform and its applications
Laplace Transform and its applications
DeepRaval7
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
Differential Equations Lecture: Non-Homogeneous Linear Differential Equations
Differential Equations Lecture: Non-Homogeneous Linear Differential EquationsDifferential Equations Lecture: Non-Homogeneous Linear Differential Equations
Differential Equations Lecture: Non-Homogeneous Linear Differential Equations
bullardcr
 
Functions in python
Functions in pythonFunctions in python
Functions in python
colorsof
 
TYPES OF ERRORS.pptx
TYPES OF ERRORS.pptxTYPES OF ERRORS.pptx
TYPES OF ERRORS.pptx
muskanaggarwal84101
 
Series parallel resonance circuit
Series parallel resonance circuitSeries parallel resonance circuit
Series parallel resonance circuit
Praveen Vaidya
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
Dhammpal Ramtake
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Damian T. Gordon
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Santosh V
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Ameen San
 
Matlab Functions
Matlab FunctionsMatlab Functions
Matlab Functions
Umer Azeem
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
Alamgir Hossain
 
Loops in matlab
Loops in matlabLoops in matlab
Loops in matlab
TUOS-Sam
 
Applications Of Laplace Transforms
Applications Of Laplace TransformsApplications Of Laplace Transforms
Applications Of Laplace Transforms
Ketaki_Pattani
 
Laplace Transform and its applications
Laplace Transform and its applicationsLaplace Transform and its applications
Laplace Transform and its applications
DeepRaval7
 
Differential Equations Lecture: Non-Homogeneous Linear Differential Equations
Differential Equations Lecture: Non-Homogeneous Linear Differential EquationsDifferential Equations Lecture: Non-Homogeneous Linear Differential Equations
Differential Equations Lecture: Non-Homogeneous Linear Differential Equations
bullardcr
 
Functions in python
Functions in pythonFunctions in python
Functions in python
colorsof
 
Series parallel resonance circuit
Series parallel resonance circuitSeries parallel resonance circuit
Series parallel resonance circuit
Praveen Vaidya
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 

Similar to Matlab commands (20)

Matlab commands
Matlab commandsMatlab commands
Matlab commands
Tarun Gehlot
 
Matlab Manual
Matlab ManualMatlab Manual
Matlab Manual
Thesis Scientist Private Limited
 
matlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsxmatlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsx
lekhacce
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Mohan Raj
 
MatlabIntro (1).ppt
MatlabIntro (1).pptMatlabIntro (1).ppt
MatlabIntro (1).ppt
AkashSingh728626
 
3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx
SungaleliYuen
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its API
Jörn Guy Süß JGS
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
Tariq kanher
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
Divyanshu Rasauria
 
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LYWIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
IrlanMalik
 
WIDI ediot autis dongok part 2.ediot lu lembot lu
WIDI ediot autis dongok part 2.ediot lu lembot luWIDI ediot autis dongok part 2.ediot lu lembot lu
WIDI ediot autis dongok part 2.ediot lu lembot lu
IrlanMalik
 
Matlab quickref
Matlab quickrefMatlab quickref
Matlab quickref
Arduino Aficionado
 
Compiler Construction for DLX Processor
Compiler Construction for DLX Processor Compiler Construction for DLX Processor
Compiler Construction for DLX Processor
Soham Kulkarni
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
Retheesh Raj
 
Matlab Introduction for beginners_i .ppt
Matlab Introduction for beginners_i .pptMatlab Introduction for beginners_i .ppt
Matlab Introduction for beginners_i .ppt
DrSeemaBHegde1
 
MatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
divyapriya balasubramani
 
Matlab_Introduction_by_Michael_Medvinsky.ppt
Matlab_Introduction_by_Michael_Medvinsky.pptMatlab_Introduction_by_Michael_Medvinsky.ppt
Matlab_Introduction_by_Michael_Medvinsky.ppt
khaliq1
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
WIDI ediot autis dongok part 1.ediot lu lemot lu setan lu
WIDI ediot autis dongok part 1.ediot lu lemot lu setan luWIDI ediot autis dongok part 1.ediot lu lemot lu setan lu
WIDI ediot autis dongok part 1.ediot lu lemot lu setan lu
IrlanMalik
 
matlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsxmatlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsx
lekhacce
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Mohan Raj
 
3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx
SungaleliYuen
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its API
Jörn Guy Süß JGS
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
Tariq kanher
 
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LYWIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
IrlanMalik
 
WIDI ediot autis dongok part 2.ediot lu lembot lu
WIDI ediot autis dongok part 2.ediot lu lembot luWIDI ediot autis dongok part 2.ediot lu lembot lu
WIDI ediot autis dongok part 2.ediot lu lembot lu
IrlanMalik
 
Compiler Construction for DLX Processor
Compiler Construction for DLX Processor Compiler Construction for DLX Processor
Compiler Construction for DLX Processor
Soham Kulkarni
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
Retheesh Raj
 
Matlab Introduction for beginners_i .ppt
Matlab Introduction for beginners_i .pptMatlab Introduction for beginners_i .ppt
Matlab Introduction for beginners_i .ppt
DrSeemaBHegde1
 
MatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MatlabIntroduction presentation xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
divyapriya balasubramani
 
Matlab_Introduction_by_Michael_Medvinsky.ppt
Matlab_Introduction_by_Michael_Medvinsky.pptMatlab_Introduction_by_Michael_Medvinsky.ppt
Matlab_Introduction_by_Michael_Medvinsky.ppt
khaliq1
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
WIDI ediot autis dongok part 1.ediot lu lemot lu setan lu
WIDI ediot autis dongok part 1.ediot lu lemot lu setan luWIDI ediot autis dongok part 1.ediot lu lemot lu setan lu
WIDI ediot autis dongok part 1.ediot lu lemot lu setan lu
IrlanMalik
 
Ad

More from Thim Mengly(ម៉េងលី,孟李) (20)

Introduction to-matlab
Introduction to-matlabIntroduction to-matlab
Introduction to-matlab
Thim Mengly(ម៉េងលី,孟李)
 
Matlab by Prof.Keang Sè Pouv
Matlab by Prof.Keang Sè PouvMatlab by Prof.Keang Sè Pouv
Matlab by Prof.Keang Sè Pouv
Thim Mengly(ម៉េងលី,孟李)
 
Assignment fluid year 3
Assignment fluid  year 3Assignment fluid  year 3
Assignment fluid year 3
Thim Mengly(ម៉េងលី,孟李)
 
មេកានិកនៃសន្ទនីយ៍
មេកានិកនៃសន្ទនីយ៍មេកានិកនៃសន្ទនីយ៍
មេកានិកនៃសន្ទនីយ៍
Thim Mengly(ម៉េងលី,孟李)
 
fluid khmer-Chapter5
fluid khmer-Chapter5fluid khmer-Chapter5
fluid khmer-Chapter5
Thim Mengly(ម៉េងលី,孟李)
 
fluid khmer-Chapter 4
fluid khmer-Chapter 4fluid khmer-Chapter 4
fluid khmer-Chapter 4
Thim Mengly(ម៉េងលី,孟李)
 
fluid khmer-Chapter 3
fluid khmer-Chapter 3fluid khmer-Chapter 3
fluid khmer-Chapter 3
Thim Mengly(ម៉េងលី,孟李)
 
fluid khmer-Chapter 2
fluid khmer-Chapter 2fluid khmer-Chapter 2
fluid khmer-Chapter 2
Thim Mengly(ម៉េងលី,孟李)
 
ក្រប់គ្រងសំណង់
ក្រប់គ្រងសំណង់ក្រប់គ្រងសំណង់
ក្រប់គ្រងសំណង់
Thim Mengly(ម៉េងលី,孟李)
 
Math cad lesson etc by Sok Raksmey
Math cad lesson etc by Sok RaksmeyMath cad lesson etc by Sok Raksmey
Math cad lesson etc by Sok Raksmey
Thim Mengly(ម៉េងលី,孟李)
 
ប្រវត្តិសម្តេចHun sen
ប្រវត្តិសម្តេចHun senប្រវត្តិសម្តេចHun sen
ប្រវត្តិសម្តេចHun sen
Thim Mengly(ម៉េងលី,孟李)
 
ប្រវត្តិសម្តេចHun sen
ប្រវត្តិសម្តេចHun senប្រវត្តិសម្តេចHun sen
ប្រវត្តិសម្តេចHun sen
Thim Mengly(ម៉េងលី,孟李)
 
ស្រីហិតោបទេស​១
ស្រីហិតោបទេស​១ស្រីហិតោបទេស​១
ស្រីហិតោបទេស​១
Thim Mengly(ម៉េងលី,孟李)
 
Report of Visit Internship
Report of Visit Internship Report of Visit Internship
Report of Visit Internship
Thim Mengly(ម៉េងលី,孟李)
 
Important Comment used in AutoCAD 2D Khmer Guide
Important Comment used in AutoCAD 2D Khmer Guide Important Comment used in AutoCAD 2D Khmer Guide
Important Comment used in AutoCAD 2D Khmer Guide
Thim Mengly(ម៉េងលី,孟李)
 
Traveaux Pratique Topographie à l'ITC-I3-GRU32
Traveaux Pratique Topographie à l'ITC-I3-GRU32Traveaux Pratique Topographie à l'ITC-I3-GRU32
Traveaux Pratique Topographie à l'ITC-I3-GRU32
Thim Mengly(ម៉េងលី,孟李)
 
Résistance des Matérieaux
Résistance des Matérieaux Résistance des Matérieaux
Résistance des Matérieaux
Thim Mengly(ម៉េងលី,孟李)
 
Project Of Irrigation at Stoeung Chhinit, Kg.Thom, KHmer
Project Of Irrigation at Stoeung Chhinit, Kg.Thom, KHmer Project Of Irrigation at Stoeung Chhinit, Kg.Thom, KHmer
Project Of Irrigation at Stoeung Chhinit, Kg.Thom, KHmer
Thim Mengly(ម៉េងលី,孟李)
 
Ad

Recently uploaded (20)

Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)
samueljackson3773
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)
samueljackson3773
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 

Matlab commands

  • 1. MATLAB Commands – 1 MATLAB Commands and Functions Dr. Brian Vick Mechanical Engineering Department Virginia Tech General Purpose Commands Operators and Special Characters / 3 Commands for Managing a Session / 3 Special Variables and Constants / 4 System and File Commands / 4 Input/Output and Formatting Commands Input/Output Commands / 5 Format Codes for fprintf and fscanf / 5 Numeric Display Formats / 5 Vector, Matrix and Array Commands Array Commands / 6 Special Matrices / 6 Matrix Arithmetic / 6 Matrix Commands for Solving Linear Equations / 6 Cell Array Functions / 7 Structure Functions / 7 Plotting Commands Basic xy Plotting Commands / 8 Plot Enhancement Commands / 8 Specialized Plot Commands / 8 Colors, Symbols and Line Types / 9 Three-Dimensional Plotting Commands / 9 Histogram Functions / 9
  • 2. MATLAB Commands – 2 Programming Logical and Relational Operators / 10 Program Flow Control / 10 Logical Functions / 10 M-Files / 11 Timing /11 Mathematical Functions Exponential and Logarithmic Functions / 12 Trigonometric Functions / 12 Hyperbolic Functions / 12 Complex Functions / 13 Statistical Functions / 13 Random Number Functions / 13 Numeric Functions / 13 String Functions / 13 Numerical Methods Polynomial and Regression Functions / 14 Interpolation Functions / 14 Numerical Integration Functions / 14 Numerical Differentiation Functions / 14 ODE Solvers / 15 Predefined Input Functions / 15 Symbolic Math Toolbox Functions for Creating and Evaluating Symbolic Expressions / 16 Functions for Manipulating Symbolic Expressions / 16 Symbolic Calculus Functions / 16 Symbolic Solution of Algebraic and Transcendental Equations / 17 Symbolic Solution of Differential Equations / 17 Laplace Transform Functions / 17 Symbolic Linear Algebra Functions / 17
  • 3. MATLAB Commands – 3 General Purpose Commands Operators and Special Characters + Plus; addition operator. - Minus; subtraction operator. * Scalar and matrix multiplication operator. .* Array multiplication operator. ^ Scalar and matrix exponentiation operator. .^ Array exponentiation operator. Left-division operator. / Right-division operator. . Array left-division operator. ./ Array right-division operator. : Colon; generates regularly spaced elements and represents an entire row or column. ( ) Parentheses; encloses function arguments and array indices; overrides precedence. [ ] Brackets; enclosures array elements. . Decimal point. … Ellipsis; line-continuation operator. , Comma; separates statements and elements in a row. ; Semicolon; separates columns and suppresses display. % Percent sign; designates a comment and specifies formatting. _ Quote sign and transpose operator. ._ Nonconjugated transpose operator. = Assignment (replacement) operator. Commands for Managing a Session clc Clears Command window. clear Removes variables from memory. exist Checks for existence of file or variable. global Declares variables to be global. help Searches for a help topic. lookfor Searches help entries for a keyword. quit Stops MATLAB. who Lists current variables. whos Lists current variables (long display).
  • 4. MATLAB Commands – 4 Special Variables and Constants ans Most recent answer. eps Accuracy of floating-point precision. i,j The imaginary unit .1- Inf Infinity. NaN Undefined numerical result (not a number). pi The number p . System and File Commands cd Changes current directory. date Displays current date. delete Deletes a file. diary Switches on/off diary file recording. dir Lists all files in current directory. load Loads workspace variables from a file. path Displays search path. pwd Displays current directory. save Saves workspace variables in a file. type Displays contents of a file. what Lists all MATLAB files in the current directory. wklread Reads .wk1 spreadsheet file.
  • 5. MATLAB Commands – 5 Input/Output and Formatting Commands Input/Output Commands disp Displays contents of an array or string. fscanf Read formatted data from a file. format Controls screen-display format. fprintf Performs formatted writes to screen or file. input Displays prompts and waits for input. ; Suppresses screen printing. Format Codes for fprintf and fscanf %s Format as a string. %d Format as an integer. %f Format as a floating point value. %e Format as a floating point value in scientific notation. %g Format in the most compact form: %f or %e. n Insert a new line in the output string. t Insert a tab in the output string. Numeric Display Formats format short Four decimal digits (default). format long 16 decimal digits. format short e Five digits plus exponent. format long e 16 digits plus exponents. format bank Two decimal digits. format + Positive, negative, or zero. format rat Rational approximation. format compact Suppresses some line feeds. format loose Resets to less compact display mode.
  • 6. MATLAB Commands – 6 Vector, Matrix and Array Commands Array Commands cat Concatenates arrays. find Finds indices of nonzero elements. length Computers number of elements. linspace Creates regularly spaced vector. logspace Creates logarithmically spaced vector. max Returns largest element. min Returns smallest element. prod Product of each column. reshape Change size size Computes array size. sort Sorts each column. sum Sums each column. Special Matrices eye Creates an identity matrix. ones Creates an array of ones. zeros Creates an array of zeros. Matrix Arithmetic cross Computes cross products. dot Computes dot products. Matrix Commands for Solving Linear Equations det Computes determinant of an array. inv Computes inverse of a matrix. pinv Computes pseudoinverse of a matrix. rank Computes rank of a matrix. rref Computes reduced row echelon form.
  • 7. MATLAB Commands – 7 Cell Array Functions cell Creates cell array. celldisp Displays cell array. cellplot Displays graphical representation of cell array. num2cell Converts numeric array to cell array. deal Matches input and output lists. iscell Identifies cell array. Structure Functions fieldnames Returns field names in a structure array. getfield Returns field contents of a structure array. isfield Identifies a structure array field. isstruct Identifies a structure array. rmfield Removes a field from a structure array. setfield Sets contents of field. struct Creates structure array.
  • 8. MATLAB Commands – 8 Plotting Commands Basic xy Plotting Commands axis Sets axis limits. fplot Intelligent plotting of functions. grid Displays gridlines. plot Generates xy plot. print Prints plot or saves plot to a file title Puts text at top of plot. xlabel Adds text label to x-axis. ylabel Adds text label to y-axis. Plot Enhancement Commands axes Creates axes objects. close Closes the current plot. close all Closes all plots. figure Opens a new figure window. gtext Enables label placement by mouse. hold Freezes current plot. legend Legend placement by mouse. refresh Redraws current figure window. set Specifies properties of objects such as axes. subplot Creates plots in subwindows. text Places string in figure. Specialized Plot Commands bar Creates bar chart. loglog Creates log-log plot. polar Creates polar plot. semilogx Creates semilog plot (logarithmic abscissa). semilogy Creates semilog plot (logarithmic ordinate). stairs Creates stairs pot. stem Creates stem plot.
  • 9. MATLAB Commands – 9 Colors, Symbols and Line Types Color Symbol Line y yellow . point - solid m magenta o circle : dotted c cyan x x-mark -. dash dotted r red + plus -- dashed g green * star b blue d diamond w white v triangle (down) k black ^ triangle (up) < triangle (left) > triangle (right) p pentagram h hexagram Three-Dimensional Plotting Commands contour Creates contour plot. mesh Creates three-dimensional mesh surface plot. meshc Same as mesh with contour plot underneath. meshz Same as mesh with vertical lines underneath. plot3 Creates three-dimensional plots from lines and points. surf Creates shaded three-dimensional mesh surface plot. surfc Same as surf with contour plot underneath. meshgrid Creates rectangular grid. waterfall Same as mesh with mesh lines in one direction. zlabel Adds text label to z-axis. Histogram Functions bar Creates a bar chart. hist Aggregates the data into equally spaced bins. histc Aggregates the data into unequally spaced bins.
  • 10. MATLAB Commands – 10 Programming Logical and Relational Operators == Relational operator: equal to. ~= Relational operator: not equal to. < Relational operator: less than. <= Relational operator: less than or equal to. > Relational operator: greater than. >= Relational operator: greater than or equal to. & Logical operator: AND. | Logical operator: OR. ~ Logical operator: NOT. xor Logical operator: EXCLUSIVE OR. Program Flow Control break Terminates execution of a loop. case Provides alternate execution paths within switch structure. else Delineates alternate block of statements. elseif Conditionally executes statements. end Terminates for, while, and if statements. error Display error messages. for Repeats statements a specific number of times if Executes statements conditionally. otherwise Default part of switch statement. return Return to the invoking function. switch Directs program execution by comparing point with case expressions. warning Display a warning message. while Repeats statements an indefinite number of times. Logical Functions any True if any elements are nonzero. all True if all elements are nonzero. find Finds indices of nonzero elements. finite True if elements are finite. isnan True if elements are undefined. isinf True if elements are infinite. isempty True if matrix is empty. isreal True if all elements are real.
  • 11. MATLAB Commands – 11 M-Files eval Interpret strings containing Matlab expressions. feval Function evaluation. function Creates a user-defined function M-file. global Define global variables. nargin Number of function input arguments. nargout Number of function output arguments. script Script M-files Timing cputime CPU time in seconds. clock Current date and time as date vector. tic, toc Start, stop a stopwatch timer.
  • 12. MATLAB Commands – 12 Mathematical Functions Exponential and Logarithmic Functions exp(x) Exponential; ex . log(x) Natural logarithm; ln(x). log10(x) Common (base 10) logarithm; log(x)= log10(x). sqrt(x) Square root; .x Trigonometric Functions acos(x) Inverse cosine; arcos x = cos –1 (x). acot(x) Inverse cotangent; arccot x = cot –1 (x). acsc(x) Inverse cosecant; arcs x = csc –1 (x). asec(x) Inverse secant; arcsec x = sec –1 (x). asin(x) Inverse sine; arcsin x = sin –1 (x). atan(x) Inverse tangent; arctan x = tan –1 (x). atan2(y,x) Four-quadrant inverse tangent. cos(x) Cosine; cos(x). cot(x) Cotangent; cot(x). csc(x) Cosecant; csc(x). sec(x) Secant; sec(x). sin(x) Sine; sin(x). tan(x) Tangent; tan(x). Hyperbolic Functions acosh(x) Inverse hyperbolic cosine; cosh –1 (x). acoth(x) Inverse hyperbolic cotangent; coth –1 (x). acsch(x) Inverse hyperbolic cosecant; csch –1 (x). asech(x) Inverse hyperbolic secant; sech –1 (x). asinh(x) Inverse hyperbolic sine; sinh –1 (x). atanh(x) Inverse hyperbolic tangent; tanh –1 (x). cosh(x) Hyperbolic cosine; cosh(x). coth(x) Hyperbolic cotangent; cosh(x)/sinh(x). csch(x) Hyperbolic cosecant; 1/sinh(x). sech(x) Hyperbolic secant; 1/cosh(x). sinh(x) Hyperbolic sine; sinh(x). tanh(x) Hyperbolic tangent; sinh(x)/cosh(x).
  • 13. MATLAB Commands – 13 Complex Functions abs(x) Absolute value; |x|. angle(x) Angle of a complex number x. conj(x) Complex conjugate of x. imag(x) Imaginary part of a complex number x. real(x) Real part of a complex number x. Statistical Functions erf(x) Computes the error function erf (x). mean Calculates the average. median Calculates the median. std Calculates the standard deviation. Random Number Functions rand Generates uniformly distributed random numbers between 0 and 1. randn Generates normally distributed random numbers. Numeric Functions ceil Rounds to the nearest integer toward •. fix Rounds to the nearest integer toward zero. floor Rounds to the nearest integer toward - •. round Rounds towards the nearest integer. sign Signum function. String Functions findstr Finds occurrences of a string. strcmp Compares strings. char Creates character string array
  • 14. MATLAB Commands – 14 Numerical Methods Polynomial and Regression Functions conv Computes product of two polynomials deconv Computes ratio of polynomials. eig Computes the eigenvalues of a matrix. poly Computes polynomial from roots. polyfit Fits a polynomial to data. polyval Evaluates polynomial and generates error estimates. roots Computes polynomial roots. Interpolation Functions interp1 Linear and cubic-spline interpolations of a function of one variable. interp2 Linear interpolation of a function of two variables. spline Cubic-spline interpolation. unmkpp Computes the coefficients of cubic-spine polynomials. Root Finding and Minimization fmin Finds minimum of single-variable function. fmins Finds minimum of multivariable function. fzero Finds zero of single-variable function. Numerical Integration Functions quad Numerical integration with adaptive Simpson’s rule. quadl Numerical integration with adaptive Lobatto quadrature. trapz Numerical integration with the trapezoidal rule. Numerical Differentiation Functions diff(x) Computes the difference between adjacent elements in the vector x. polyder Differentiates a polynomial, a polynomial product, or a polynomial quotient.
  • 15. MATLAB Commands – 15 ODE Solvers ode23 Nonstiff, low-order solver. ode45 Nonstiff, medium-order solver. ode113 Nonstiff, variable-order solver. ode23s Stiff, low-order. ode23t Moderately stiff, trapezoidal rule solver. ode23b Stiff, low-order solver. ode15s Stiff, variable-order solver. odeset Creates integrator options structure for ODE solvers. Predefined Input Functions gensig Generates a periodic sine, square, or pulse input. sawtooth Generates a periodic sawtooth input. square Generates a square wave input. stepfun Generates a step function input.
  • 16. MATLAB Commands – 16 Symbolic Math Toolbox Functions for Creating and Evaluating Symbolic Expressions class Returns the class of an expression. digits Sets the number of decimal digits used to do variable precision arithmetic. double Converts an expression to numeric form. ezplot Generates a plot of a symbolic expression. findsym Finds the symbolic variables in a symbolic expression. numden Returns the numerator and denominator of an expression. sym Creates a symbolic variable. syms Creates one or more symbolic variables. vpa Sets the number of digits used to evaluate expressions. Functions for Manipulating Symbolic Expressions collect Collects coefficients of like powers in an expression. expand Expands an expression by carrying out jpowers. factor Factors an expression. poly2sym Converts a polynomial coefficient vector to a symbolic polynomial. pretty Displays an expression in a form that resembles typeset mathematics. simple Searches for the shortest form of an expression. simplify Simplifies an expression using Maple’s simplification rules. subs Substitutes variables or expressions. sym2poly Converts an expression to a polynomial coefficient vector. Symbolic Calculus Functions diff Returns the derivative of an expression. Dirac Dirac delta function (unit impulse). Heaviside Heaviside function (unit step). int Returns the integral of an expression. limit Returns the limit of an expression. symsum Returns the symbolic summation of an expression. taylor Returns the Taylor series of a function.
  • 17. MATLAB Commands – 17 Symbolic Solution of Algebraic and Transcendental Equations solve Solves symbolic equations. Symbolic Solution of Differential Equations dsolve Returns a symbolic solution of a differential equation or set of equations. Laplace Transform Functions ilaplace Returns the inverse Laplace transform. laplace Returns the Laplace transform. Symbolic Linear Algebra Functions det Returns the determinant of a matrix. eig Returns the eigenvalues (characteristic roots) of a matrix. inv Returns the inverse of a matrix. poly Returns the characteristic polynomial of a matrix.