0% found this document useful (0 votes)
30 views

Assignment #2 (Keywords)

The document lists various MATLAB keywords and their functions. Some keywords return matrices of zeros or ones, or matrices with values on the diagonal. Other keywords perform operations on matrices like transposition, determinant, inverse, and sine/cosine. Additional keywords find minimum/maximum values, sort arrays, round values, and perform logarithmic, exponential and other mathematical functions on arrays. Keywords are also included to clear variables and figures from the workspace.

Uploaded by

Ranim Hisham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Assignment #2 (Keywords)

The document lists various MATLAB keywords and their functions. Some keywords return matrices of zeros or ones, or matrices with values on the diagonal. Other keywords perform operations on matrices like transposition, determinant, inverse, and sine/cosine. Additional keywords find minimum/maximum values, sort arrays, round values, and perform logarithmic, exponential and other mathematical functions on arrays. Keywords are also included to clear variables and figures from the workspace.

Uploaded by

Ranim Hisham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MATLAB Keywords

• Zeros(m, n): it returns an m by n matrix of zeros.

• Ones(m, n): it returns an m by n matrix of ones.

• Eye(m, n): it returns an m by n matrix with 1's on the diagonal and 0's elsewhere.

• Transpose(X): it returns the nonconjugate transpose of X, that is, interchanges the row and column
index for each element.

• Linspace: it generates linearly spaced vectors. It is similar to the colon operator ":", but gives direct
control over the number of points.

• Det(X): it returns the determinant of the square matrix X. If X contains only integer entries, the result
is also an integer.

• Rank: it provides an estimate of the number of linearly independent rows or columns of a full matrix.

• Inv(X): it computes the inverse of square matrix X.

• Sin(X): it returns the sine of the elements of X. The sin function operates element-wise on arrays. The
function accepts both real and complex inputs.

• Asin(X): it returns the inverse sine (arcsine) for each element of X.

• Sind(X): it returns the sine of the elements in X, which are expressed in degrees.

• Min(A): it returns the smallest elements along different dimensions of an array. If A is a vector, min(A)
returns the smallest element in A. If A is a matrix, min(A) treats the columns of A as vectors, returning a
row vector containing the minimum element from each column.

• Max(A): it returns the maximum elements of an array. If A is a vector, then max(A) returns the maximum
of A. If A is a matrix, then max(A) is a row vector containing the maximum value of each column.

• Log(X): it returns the natural logarithm ln(x) of each element in array X.

• Log10(X): it returns the common logarithm of each element in array X. The function accepts both real
and complex inputs.

• Exp(X): it returns the exponential for each element of X. For complex elements, it returns the complex
exponential.
• Find(X): it returns the indices of the array X that point to nonzero elements. If none is found, find returns
an empty matrix.

• Clc: it clears all the text from the Command Window, resulting in a clear screen.

• Clear: it removes all variables from the workspace and frees up system memory.

• Factorial(n): it returns the product of all positive integers less than or equal to n, where n is a
nonnegative integer value.

• Rem(x,y): it returns the remainder after division of x by y, where x is the dividend and y is the divisor.

• Round(X): it rounds each element of X to the nearest integer. In the case of a tie, where an element
has a fractional part of exactly 0.5, the round function rounds away from zero to the integer with larger
magnitude.

• Sort(X): it sorts the elements along different dimensions of an array, and arranges those elements in
ascending order.

• Floor(X): it rounds the elements of A to the nearest integers less than or equal to X. For complex values
of X, the imaginary and real parts are rounded independently.

• Ceil(X): it rounds the elements of A to the nearest integers greater than or equal to X. For complex X,
the imaginary and real parts are rounded independently.

• Figure: it creates a new figure window using default property values.

• Plot(X,Y): it creates a 2-D line plot of the data in Y versus the corresponding values in X.

• Length(X): it returns the length of the largest array dimension in X. For vectors, the length is simply the
number of elements.

• Size(X): it returns a row vector whose elements contain the length of the corresponding dimension
of X.

You might also like