You are on page 1of 4

Basic Commands in MATLAB

ECE COMPUTER APPLICATIONS LABORATORY 59040 / 8:00-11:00 / Friday

Submitted by: Llamera, Paul Hubert P. Mamauag, Cristine C. BS ECE

Scalar Arithmetic Operations

Symbol ^ * / \ + -

Operation Exponential Multiplication Right Division Left Division Addition Subtraction

MATLAB Form A^B A*B A/B A\B A+B A-B

Special Variables and Constants


Command Ans eps i,j Inf NaN pi Description Temporary variable containing the most recent answer Specifies the accuracy of floating point precision The imaginary unit sqrt (-1) Infinity Indicates an undefined numerical result The number

Relational Operators
Relational Operator < <= > >= == = Meaning Less than Less than or Equal to Greater than Greater than or Equal to Equal to Not equal to

Commands for Managing the work sessions

Command Clc Clear Clear var1 Exist (name) Quit Who Whos

Description Clears the command window Removes all variable from memory Removes var1 form memory Determine if a file or variable exist having the name name Stops MATLAB Lists the variables currently in memory Lists the current variables and sizes, and indicates if they have imaginary parts Colon: generates an array having regularly spaced elements. Comma: separates elements of an array. Semicolon: suppresses screen printing; also denotes a new row in an array. Ellipsis: continues a line.

System, Directory and File Commands


Command Addpath dirname Cd dirname Dir Dir dirname Path Pathtool Pwd Rmpath dirname What What dirname Description Adds the directory dirname to the search path Changes the current directory dirname Lists all files in the current directory Lists all the files in the directory dirname Displays the MATLAB search path Starts the path browser Displays the current directorry Removes the directory dirname from the search path Lists file found in the current working directory Lists the specific files in the directory

Miscellaneous Functions
Command Asin(x) Cos(x) Exp(x) Dir dirname Length(x) Log(x) Log10(x) Mean(x) Sin(x) Sqrt(x) Std(x) Description Computes the inverse sin, or arcsine of x Computes the cosine of x Computes the exponential of x, ex Lists all the files in the directory dirname Computes the number of elements in the array of x Computes the natural logarithm of x, lnx Computes the base-10 logarithm of x, logx = log10x Computes the mean of x Computes the sine of x Computes the square root of x Computes the standard deviation of x

You might also like