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

Lab Manual

MATLAB is a matrix-based programming language used for numerical computation, visualization, and application development. It provides a built-in library of mathematical functions and tools for building custom graphical interfaces and integrating algorithms with external applications. MATLAB allows users to enter commands interactively and provides commands for managing workspaces, input/output, matrices, plotting, and more.

Uploaded by

saniljayamohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

Lab Manual

MATLAB is a matrix-based programming language used for numerical computation, visualization, and application development. It provides a built-in library of mathematical functions and tools for building custom graphical interfaces and integrating algorithms with external applications. MATLAB allows users to enter commands interactively and provides commands for managing workspaces, input/output, matrices, plotting, and more.

Uploaded by

saniljayamohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Introduction to Matlab

The name MATLAB stands for MATrix LABoratory developed by Mathworks Inc;
USA. It is a matrix based powerful software package for scientific and engineering numerical
computation and visualization. Complex numerical problems can be solved in a fraction of time
that required with other high level languages. It provides an interactive environment with
thousands of built in functions for technical computation, graphics and animation. In addition
to built in- functions, user can create his own functions. MATLAB offers several option
toolboxes, such as signal processing, control systems, neural networks etc. It is a command
driven software and has online help facilities. All commands and the ready to run program file
name can be typed in the command window to execute them. Figure window gives the display of
the figures as the result of the program. Edit window is to create files with an extension.m.

Features of MATLAB
Following are the basic features of MATLAB:
It is a high-level language for numerical computation, visualization and application
development.
It also provides an interactive environment for iterative exploration, design and problem
solving.
It provides vast library of mathematical functions for linear algebra, statistics, Fourier
analysis, filtering, optimization, numerical integration and solving ordinary differential
equations.
It provides built-in graphics for visualizing data and tools for creating custom plots.
MATLAB's programming interface gives development tools for improving code quality
and maintainability and maximizing performance.
It provides tools for building applications with custom graphical interfaces.
It provides functions for integrating MATLAB based algorithms with external
applications and languages such as C, Java, .NET and Microsoft Excel.

Uses of MATLAB

MATLAB is widely used as a computational tool in science and engineering
encompassing the fields of physics, chemistry, math and all engineering streams. It is
used in a range of applications including:
Signal Processing and Communications
Image and Video Processing
Control Systems
Test and Measurement
Computational Finance
Computational Biology

MATLAB is an interactive program for numerical computation and data visualization. You can
enter a command by typing it at the MATLAB prompt '>>' on the Command Window.
Commands for Managing a Session
MATLAB provides various commands for managing a session. The following table provides all such commands:
Command Purpose
clc Clears command window.
clear Removes variables from memory.
exist Checks for existence of file or variable.
global Declares variables to be global.
help Searches for a help topic.
lookfor Searches help entries for a keyword.
quit Stops MATLAB.
who Lists current variables.
whos Lists current variables (long display).

Commands for Working with the System
MATLAB provides various useful commands for working with the system, like saving the
current work in the workspace as a file and loading the file later.
It also provides various commands for other system-related activities like, displaying date, listing
files in the directory, displaying current directory, etc.



The following table displays some commonly used system-related commands:
Command Purpose
cd Changes current directory.
date Displays current date.
delete Deletes a file.
diary Switches on/off diary file recording.
dir Lists all files in current directory.
load Loads workspace variables from a file.
path Displays search path.
pwd Displays current directory.
save Saves workspace variables in a file.
type Displays contents of a file.
what Lists all MATLAB files in the current directory.
wklread Reads .wk1 spreadsheet file.
Input and Output Commands
MATLAB provides the following input and output related commands:
Command Purpose
disp Displays contents of an array or string.
fscanf Read formatted data from a file.
format Controls screen-display format.
fprintf Performs formatted writes to screen or file.
input Displays prompts and waits for input.
; Suppresses screen printing.
Vector, Matrix and Array Commands
The following table shows various commands used for working with arrays, matrices and vectors:
Command Purpose
cat Concatenates arrays.
find Finds indices of nonzero elements.
length Computes number of elements.
linspace Creates regularly spaced vector.
logspace Creates logarithmically spaced vector.
max Returns largest element.
min Returns smallest element.
prod Product of each column.
reshape Changes size.
size Computes array size.
sort Sorts each column.
sum Sums each column.
eye Creates an identity matrix.
ones Creates an array of ones.
zeros Creates an array of zeros.
cross Computes matrix cross products.
dot Computes matrix dot products.
det Computes determinant of an array.
inv Computes inverse of a matrix.
pinv Computes pseudoinverse of a matrix.
rank Computes rank of a matrix.
rref Computes reduced row echelon form.
cell Creates cell array.
celldisp Displays cell array.
cellplot Displays graphical representation of cell array.
num2cell Converts numeric array to cell array.
deal Matches input and output lists.
iscell Identifies cell array.
Plotting Commands
MATLAB provides numerous commands for plotting graphs. The following table shows some of the commonly used
commands for plotting:
Command Purpose
axis Sets axis limits.
fplot Intelligent plotting of functions.
grid Displays gridlines.
plot Generates xy plot.
print Prints plot or saves plot to a file.
title Puts text at top of plot.
xlabel Adds text label to x-axis.
ylabel Adds text label to y-axis.
axes Creates axes objects.
close Closes the current plot.
close all Closes all plots.
figure Opens a new figure window.
gtext Enables label placement by mouse.
hold Freezes current plot.
legend Legend placement by mouse.
refresh Redraws current figure window.
set Specifies properties of objects such as axes.
subplot Creates plots in subwindows.
text Places string in figure.
bar Creates bar chart.
loglog Creates log-log plot.
polar Creates polar plot.
semilogx Creates semilog plot. (logarithmic abscissa).
semilogy Creates semilog plot. (logarithmic ordinate).
stairs Creates stairs plot.
stem Creates stem plot.

You might also like