Department of Engineering

IT Services

The MATLAB Language

The MATLAB interface is a command line interface rather like most BASIC environments. However MATLAB works almost exclusively with matrices : scalars simply being 1-by-1 matrices. At the most elementary level, MATLAB can be a glorified calculator:


>> fred=6*7

>> FRED=fred*j;
>> exp(pi*FRED/42)
>> whos

MATLAB is case sensitive so that the two variables fred and FRED are different. The result of an expression is printed out unless you terminate the statement by a ` ;'. j (and i) represent the square root of -1 unless you define them otherwise. who lists the current environment variable names and whos provides details such as size, total number of elements and type. Note that the variable ans is set if you type a statement without an ` =' sign.