- Command Description
- CLC clearing of command window.
- CLOSE ALL Closes all plots.
- CLEAR variables removed from the memory.
- HELP Searches for a topic you need.
- EXIST command used to check for the availability of file or variable.
- GLOBAL Declaration of variables as global.
- QUIT Stops MATLAB session.
- EPS Defining accuracy of floating-point precision.
- INF defined for Infinity.
- NAN not defining a numerical result (not a number).
- Pi The number p.
- Cd useful for changing the current directory.
- DATE present day date is displayed.
- DELETE useful for deleting a File.
- PRINT Prints a plot.
- AXIS Sets axis limits.
- GRID Gridlines will be displayed.
- PLOT plots of x and y axis will be displayed.
- PRINT Prints the plots and saved it to file.
- TITLE To provide text on top of plot.
- X-LABEL x-axis is added with labels.
- Y-LABEL y-axis is added with labels.
- HOLD fix the current plot.
- FIGURE new figure window is created.
- SUBPLOT shows plots in subwindows.
- STEM shows stem plot
- ONES Creates an array of ones.
- ZEROS A zero array is created.
- %s Format as a string.
- %d Format as an integer.
- %f Format as a floating point value.
- \n enter a new line in the output string.
- \t In order to insert a tab in the output string.
- [ ] Brackets; enclosures array elements.
- . Symbol is used to define decimal point.
- + Addition operation
- – Subtraction operation.
- * performs Scalar and matrix multiplication.
- INPUT Waits for input by displaying prompt.
- RESHAPE used to change size.
- DET perform determinant of an array.
- INV perform inverse of a matrix.
- RAND Distributed random elements uniformly.
- RANDN Random elements will be distributed normally.
DELETING ROWS AND COLUMNS:
Pair of square brackets useful for performing deleting row and column operation. Let begin with
A = D;
In order to delete the second column of A, let use the equation as shown
A (:, 2) = []
This changes A to A = 16 2 13
5 11 8
9 7 12
4 14 1
If you will delete any one element from a matrix, the result will not anymore a matrix. So, expressions like
A (1, 2) = []
Result in an error. From the above operation we know how to delete a single element, or sequence of elements, and how to change the remaining shape of the elements into a row vector.
So A(2:2:10) = []
Results in X = 1 6 9 2 7 13 12 1
DATA TYPES IN MATLAB:
With the help of different types of data types or classes you can work with you code by creating arrays, table, matrices, floating-point and so on. Matlab combines integers, floats and booleans into one thing: doubles or floating point number.
Example: >> a = 1.54 % this is a double
>> b = a > 1 % Logical (Boolean) double.
Strings. Character arrays will be treated as string matlab.
>>b = ‘abcd’ % NOTE that matlab uses single quotes
>>b (2:3)
Arrays/Matrices of numbers. In order to separate rows we use this operator ‘;‘, or same goes with blank space to separate columns ‘,’.
a= [4 5 6; 1, 2, 3].
Cell array is way to store mixed data or several strings.
d = {‘abcd’, 1, [123], ‘def’
There are 16 fundamental classes in MATLAB. Most of the classes are in the form of an array or a matrix. With the exception of function handles, this matrix or array starts with a minimum of zero in size and it will grow to an n-dimensional array of maximum size. A function will always handle in scalar matrix.