7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 1/29
MATLAB TUTORIAL
Matlab Basics
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 2/29
Purpose of this Section
To illustrate simple uses of the MATLAB
Technical language
To help you understand under whatcircumstances is MATLAB a better choice
than spreadsheets and high-level languages
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 3/29
What is MATLAB?
A high-performance language for technicalcomputing (Mathworks, 1998)
Typical uses of MATLAB
Mathematical computations
Algorithmic development
Model prototyping (prior to complex model
development)Data analysis and exploration of data(visualization)
Scientific and engineering graphics for
presentation
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 4/29
Why Matlab?
Because it simplifies the analysis of mathematical models
It frees you from coding in high-levellanguages (saves a lot of time - with somecomputational speed penalties)
Provides an extensible programming/visualization environment
Provides professional looking graphs
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 5/29
Foundation of Matlab
The name is derived from MATrix LABoratory MATLAB is a case sensitive language (a variable
named “c” is different than another one called “C”) MATLAB works with matrices everything
MATLAB understands is a matrix (from text to largecell arrays and structure arrays)
Various data types exist within MATLAB- single precision
- double precision
- integer (8 bit)
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 6/29
The Matlab Environment
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 7/29
MATLAB has the following basic windowcomponents:
Work-space
Displays all the defined variables.
Command Window
To execute commands in the MATLAB
environment Command History
Displays record of the commands used
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 8/29
Command Window
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 9/29
Command Window (Contd..)
The command window allows you to interact with
MATLAB just as if you type things in a calculator
Cut and paste operations ease the repetition of tasks Use „up-arrow‟ key to repeat commands (command
history)
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 10/29
Launch Pad
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 11/29
Launch Pad (Contd…)
The launch window allows you to quickly
select among various MATLAB components
and toolboxes
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 12/29
Matlab Workspace
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 13/29
Workspace(Contd…)
Workspace of Matlab shows all the defined
variables along with their “order”, memory
space they occupy and the class to which they belong
Above are shown a few such variables
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 14/29
Current Directory
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 15/29
Current Directory (Contd…)
Provides quick access to all files available in
your Path
Provides a brief description (when files arecommented out) of each M-file
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 16/29
Different Views
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 17/29
Different Views (Contd…)
The Matlab environment could be viewed in
various ways.
This could be accomplished by the VIEW pull-down menu as shown in the previous
slide.
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 18/29
Matlab Help
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 19/29
Matlab Help (Contd..)
Matlab Help is an extremely powerful
assistance to learn Matlab.
The Help not only contains the theoretical background but also shows the demos for
implementation
The Matlab Help could be opened by usingthe HELP pull-down menu
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 20/29
Matlab Help (Contd..)
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 21/29
Matlab Help (Contd..)
Any command description can be found by
typing the command in the search field.
As shown above the command to take squareroot (sqrt) is searched
We can also utilize the Matlab help from the
command window as shown in the next slide.
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 22/29
Matlab Help (Contd..)
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 23/29
To begin a new M-file
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 24/29
How the source-code looks like
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 25/29
The Whos Command
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 26/29
Scalar Calculation
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 27/29
Vector Calculation
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 28/29
Matrix Calculation
7/27/2019 Matlab Ttutorial 1.ppt
http://slidepdf.com/reader/full/matlab-ttutorial-1ppt 29/29
Thank You