MATLAB Commands & Functions Reference Guide

Reference guide for MATLAB functions and their applications in engineering, mathematics, and scientific computing

Mathematical Functions

Function Usage Description
absabs(A)Computes the absolute value of each element in array A.
sqrtsqrt(A)Computes the square root of each element in A.
expexp(A)Computes the exponential e^A for each element.
loglog(A)Computes natural logarithm (base e) of each element.
log10log10(A)Computes base-10 logarithm of each element.
sin / cos / tansin(A), cos(A), tan(A)Computes trigonometric functions element-wise in radians.
asin / acos / atanasin(A), acos(A), atan(A)Computes inverse trigonometric functions element-wise.
round / ceil / floorround(A), ceil(A), floor(A)Rounds values to nearest, upward, or downward integer.
modmod(A, B)Computes remainder after division of A by B.
remrem(A, B)Computes remainder after division using truncation.

Matrix and Array Functions

Function Usage Description
zeroszeros(m, n)Creates m-by-n matrix of zeros.
onesones(m, n)Creates m-by-n matrix of ones.
eyeeye(n)Generates n-by-n identity matrix.
sizesize(A)Returns the dimensions of matrix A.
lengthlength(A)Returns the largest dimension of A.
sumsum(A)Computes sum along a dimension.
meanmean(A)Calculates arithmetic mean.
stdstd(A)Computes standard deviation.
maxmax(A)Returns maximum value(s) in A.
minmin(A)Returns minimum value(s) in A.
diagdiag(A)Extracts or creates diagonal elements of a matrix.
invinv(A)Computes inverse of square matrix A.
detdet(A)Computes determinant of square matrix A.
rankrank(A)Returns rank of matrix A.
reshapereshape(A, m, n)Reshapes A into m-by-n matrix.
repmatrepmat(A, m, n)Repeats matrix A m-by-n times.

Plotting and Visualization Functions

Function Usage Description
plotplot(x, y)2D plot of vectors x and y.
figurefigureCreates new figure window.
subplotsubplot(m, n, p)Divide figure into subplots.
meshgrid[X,Y] = meshgrid(x,y)Generates 2D grid coordinates for plotting surfaces.
surfsurf(X,Y,Z)3D surface plot of matrix Z over X and Y.
contourcontour(X,Y,Z)Contour plot of matrix Z.
barbar(x, y)Creates bar chart of data y vs x.
histogramhistogram(data)Plots histogram of vector data.
scatterscatter(x, y)Scatter plot of x and y points.
xlabel / ylabelxlabel('x'), ylabel('y')Adds axis labels.
titletitle('Plot Title')Adds title to figure.
legendlegend('label1','label2')Adds legend to plot.
hold on / hold offhold on, hold offRetains or releases current plot when adding new data.

Signal Processing Functions

Function Usage Description
fftfft(x)Computes Fast Fourier Transform of vector x.
ifftifft(X)Computes inverse FFT.
filterfilter(b, a, x)Applies digital filter to signal x using coefficients b and a.
convconv(a, b)Convolves two sequences a and b.
xcorrxcorr(x, y)Computes cross-correlation between x and y.

File Input/Output Functions

Function Usage Description
savesave filenameSaves workspace variables to .mat file.
loadload filenameLoads variables from .mat file.
fopen / fclosefid = fopen('file'), fclose(fid)Open and close files for reading/writing.
fprintffprintf(fid, 'format', A)Write formatted data to file or command window.
fscanfA = fscanf(fid, 'format')Read formatted data from file.

Control Systems Functions

Function Usage Description
tftf(num, den)Creates transfer function model with numerator and denominator coefficients.
ssss(A, B, C, D)Creates state-space representation of a linear system.
stepstep(sys)Plots step response of system sys.
impulseimpulse(sys)Plots impulse response of system sys.
bodebode(sys)Plots Bode diagram (frequency response) of system sys.
nyquistnyquist(sys)Plots Nyquist diagram of system sys.
rlocusrlocus(sys)Plots root locus of system sys.

About MATLAB Commands and Functions

This MATLAB functions reference provides a categorized overview of built-in commands used for mathematical computation, engineering simulation, and scientific data analysis. It’s designed for students, researchers, and professionals who want to improve their efficiency when working with MATLAB for modeling, analysis, and automation.


Applications


By mastering key MATLAB functions, you can:


MATLAB remains one of the most widely used platforms for scientific computing, engineering design, and algorithm development. This reference serves as a practical guide to understanding and applying essential MATLAB functions for efficient technical and analytical work.