You are on page 1of 6

CHAPTER 4

MATLAB
4.1 Introduction
MATLAB

, which stands for MATrix LABoratory, is a state-of-the-art mathematical

software package, which is used extensively in both academia and industry. It is an interactive
program for numerical computation and data visualization, which along with its programming
capabilities provides a very useful tool for almost all areas of science and engineering. Unlike
other mathematical packages, such as MAPLE or MATHEMATICA, MATLAB cannot
perform symbolic manipulations without the use of additional Toolboxes. It remains however,
one of the leading software packages for numerical computation. As you might guess from its
name, MATLAB deals mainly with matrices. A scalar is a 1-by-1 matrix and a row vector of
length say 5, is a 1-by-5 matrix.
MATLAB is a fourth-generation programming language. Developed by MathWorks,
MATLAB allows matrix manipulations, plotting of functions and data, implementation of
algorithms, creation of user interfaces, and interfacing with programs written in other
languages, including C, C++, and Fortran.
In addition, MATLAB is an easy to learn programming language and various toolboxes have
been developed for it, for example Image Processing Toolbox. Despite that, MATLAB is a
high-level language and is quite efficient and suitable for algorithms that have requirements
on performance.
MATLAB features a family of application specific solution called TOOLBOXES. Very
important to most users of MATLAB, toolboxes allow you to learn and apply specialized
technology. Signal processing, control system, neural networks, fuzzy logic, wavelets, image
processing, simulation and many others.
MATLAB is a high-level language and interactive environment for numerical computation,
visualization, and programming. Using MATLAB, you can analyze data, develop algorithms,
and create models and applications. The language, tools, and built in math functions enable
you to explore multiple approaches and reach a solution faster than with spreadsheets or
35

traditional programming languages, such as C/C++ or Java . You can use MATLAB for a
range of applications, including signal processing and communications, image and video
processing, control systems, test and measurement, computational finance, and computational
biology. More than a million engineers and scientists in industry and academia use MATLAB,
the language of technical computing.
4.2 MATLAB Features

High-level language for numerical computation, visualization, and application


development.

Interactive environment for iterative exploration, design, and problem solving.

Mathematical functions for linear algebra, statistics, Fourier analysis, filtering,


optimization, numerical integration, and solving ordinary differential equations.

Built-in graphics for visualizing data and tools for creating custom plots.

Development tools for improving code quality and maintainability and maximizing
performance.

Tools for building applications with custom graphical interfaces.

Functions for integrating MATLAB based algorithms with external applications and
languages such as C, Java, .NET, and Microsoft Excel

4.3 MATLAB Software Architecture


MATLAB Consists of:

Command Window

Editor

Work Space

Current directory

Command history

36

Command Window:
Command window is use to execute commands to carryout different tasks such as creating the
variables as shown in Fig. 4.1

Fig. 4.1 : Command Window in MATLAB


Editor:
37

Interaction with MATLAB software in the MATLAB language can be done using command
window by typing commands at the command prompt. And, in command window variables
can be defined. One of the most interesting features of MATLAB is creating scripts. In case
there are lots of commands which need to be executed again and again, there exists this
feature in which commands can be added to single file that can be executed whenever
required. To create the scripts using MATLAB's built-in text editor, which automatically just
saves files as ASCII text files. Also, when saving the script files, suffix ".m" should be
appended the to the filename, for example "my_script.m". Scripts in MATLAB are also called
"M-files" because of this, and the ".m" suffix tells MATLAB that the file is associated with
MATLAB. A script editor file window is shown in Fig. 4.2

Fig. 4.2 : Script File Editor

38

Workspace:
The workspace consists of the set of variables built up during a session of using the MATLAB
software and stored in memory. You add variables to the workspace by using functions,
running M-files, and loading saved workspaces. For example, if you run these statements,
a = 5;
b = [1 2 3;4 5 6;7 8 9]
the workspace includes two variables, a and b as shown in Fig. 4.3

Fig. 4.3: Workspace Window


Current Directory:
The MATLAB software uses the current directory and the MATLAB search path as reference
points when it accesses files. If a file you want to run is not in a directory on the search path,
you can run it by changing the current directory to the file's directory. The primary way you
view and change the current directory, as well as manage, organize, and find files in
MATLAB, is with the Current Directory browser desktop tool.
Command History:
39

The Command History window displays the statements most recently run in the Command
Window. You can get those commands to command window by clicking on them. You can
also save the commands in command history by selecting them and right click and say create
M-file. The typical Command History Window is shown in Fig. 4.4

Fig. 4.4 : Command History Window

40

You might also like