Page 24 - MATLAB an introduction with applications
P. 24
MATLAB Basics ——— 9
Table 1.15 Termination
Function Description
c (Control-c) Local abort, kills the current command execution.
quit Quits MATLAB.
exit Same as quit.
1.9 ARRAYS
An array is a list of numbers arranged in rows and/or columns. A one-dimensional array is a row or a column
of numbers and a two-dimensional array has a set of numbers arranged in rows and columns. An array
operation is performed element-by-element.
1.9.1 Row Vector
A vector is a row or column of elements.
In a row vector, the elements are entered with a space or a comma between the elements inside the square
brackets. For example, x = [7 –1 2 –5 8].
1.9.2 Column Vector
In a column vector, the elements are entered with a semicolon between the elements inside the square
brackets. For example, x = [7; –1; 2; –5; 8].
1.9.3 Matrix
A matrix is a two-dimensional array which has numbers in rows and columns. A matrix is entered row-wise with
consecutive elements of a row separated by a space or a comma, and the rows separated by semicolons or
carriage returns. The entire matrix is enclosed within square brackets. The elements of the matrix may be real
numbers or complex numbers. For example, to enter the matrix,
1 3 − 4
A =
0 − 2 8
The MATLAB input command is
A = [1 3 –4 ; 0 –2 8]
Similarly, for complex number elements of a matrix B
− 5x ln 2x + 7sin3y
B =
−
3i 5 13i
The MATLAB input command is
B = [–5*x log(2*x) + 7*sin(3*y); 3i 5 – 13i]
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09