VIEWS: 1 PAGES: 40

• pg 1
```									  Engineering
Computation using
MATLAB

Dr Simin Nasseri,
Mechanical Engineering Technology Department,
Southern Polytechnic State University
Matlab
• MATLAB stands for Matrix Laboratory
• Developed primarily by Cleve Moler in the
1970's
• MATLAB was originally written in Fortran,
then later rewritten in C.
• Derived from FORTRAN subroutines LINPACK and
EISPACK, linear and eigenvalue systems.
• Rewritten in C in the 1980's with more functionality, which
include plotting routines.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Matlab
• MATLAB is one of a number of commercially
available, sophisticated mathematical computation
tools
• Others include
• Maple
• Mathematica (MATLAB's competitor = the symbolic
computation program)
• MATLAB is more convenient for numerical analysis
and linear algebra. It is frequently used in
engineering community.
• Mathematica has superior symbolic manipulation,
making it popular among physicists.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Why Matlab?!
• MATLAB is a high-performance language for technical
computing.
• It integrates computation, visualization, and
programming environment.
• MATLAB is a modern programming language
environment: it has sophisticated data structures,
contains built-in editing and debugging tools, and
supports object-oriented programming.
• These factors make MATLAB an excellent tool for
teaching and research.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Why Matlab?!
• MATLAB is widely used.
• MATLAB is easy to use.
• MATLAB is interpreted (not compiled), errors
are easy to fix.
• MATLAB is optimized to be relatively fast
when performing matrix operations.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Why Matlab?!
• A systematic problem solving strategy
makes it more likely you’ve found the right
• Built in programming language (Matlab is
a package + a language).
• Not a general purpose language like C++ or
Java.
• Matlab Excels at Numerical calculations
(Especially involving matrices) and
Graphics.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Weaknesses
• MATLAB is not a general purpose programming
language such as C, C++, or FORTRAN.
• MATLAB is designed for scientific computing, and is
not well suitable for other applications.
• MATLAB commands are specific for MATLAB usage.
Most of them do not have a direct equivalent with other
programming language commands.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Summary
MATLAB® is a high-level language and interactive
environment that enables you to perform
computationally intensive tasks faster than with
traditional programming languages such as C, C++,
and Fortran.

•Introduction and Key Features
•Developing Algorithms and Applications
•Analyzing and Accessing Data
•Visualizing Data
•Performing Numeric Computation
•Publishing Results and Deploying Applications

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Matlab 2010
• The MathWorks Inc. was created (1984) to market
and continue development of MATLAB.

• MATLAB is updated regularly.
• The Mathworks packages their software in groups,
called releases.

• Each one contains:
• MATLAB
• A number of specialized “toolboxes”

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
New Release Naming
System
• They will be issuing updates twice a year
R2010a
R2010b

• MATLAB comes in both a student and professional
edition.
• Student editions are available for:
• Windows Operating Systems
• Mac OS
• Linux

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
How is MATLAB used in Industry?

• Widespread, especially in the signal
processing field
• Tool of choice in Academia for most
engineering fields
• Some examples….

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Electrical Engineering

These images simulate the visual system used in a housefly
brain to detect collisions. The techniques developed are being
used in autonomous robot systems that depend upon vision for
navigation. The data was processed using MATLAB.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Biomedical Engineering

These images were created from MRI scan data using MATLAB.
The actual data set is included with the standard MATLAB
installation, allowing you experiment with manipulating the data
yourself.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Statics and Structures
The motion of an idealised two span bridge under the
action of a moving point force across its surface, when
the force velocity is equal to the first critical speed. The
animation was created in matlab, using the analytical
equations of motion derived in "Vibration of solids and
structures under moving loads" Fryba, L, 1999

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Dynamics

Click
and
watch

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Robotics

In this Cartesian
Motion we have fixed
the TCP (Tool Center
Point) in space at
pos=(430,0,750).
This simulation was

Click
and
watch

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Fluid Dynamics

Results from a finite element analysis code were post processed
using MATLAB to create this image.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
3D Plotting and Volume
Visualization

A 3-D isosurface plot revealing the geodesic dome
structure of a carbon-60 or “fullerene” molecule
(molecules composed entirely of carbon).

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Why @ MET?!

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Working with Matlab
• We’ll start learning the details of how to use
MATLAB now:
• In Windows or Apple operating systems click
on the desktop icon

• In Unix type:                 MATLAB at the shell prompt.
MATLAB opens to a default window configuration:

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
• MATLAB uses a standard

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
MATLAB Windows

MATLAB uses several
different windows to display
data, commands and results.
There are 7 windows. Lets
see what they are.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
1- Command Window
4- Current Directory                            Enter commands at the prompt

2- Command History
3- Workspace Window

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
1- Command Window
Enter commands at the prompt

You can use the
command window much
like you’d use a
calculator
The standard order of
operation rules apply

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
1- Command Window

1- Command Window
Enter commands at the prompt

Once you hit enter, you can’t edit any
commands
You can retype them or use the arrow keys
to retrieve commands and edit them before
hitting enter again

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
2- Command History

2- Command History

•You can transfer commands from the
command history to the command
window
•Double click on a command
•Click and drag

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
2- Command History

2- Command History

•Records the commands you issue in the command
window
•When you exit the command window, or when you
issue the clc command, the command window is
cleared
•But the command history remains

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
3- Workspace Window

3-Workspace Window
Variables that you
introduce are written
here.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Scalar

Vector

2-D
Matrix
•    Keeps track of the variables you’ve defined
(Name, Value, Size, Bytes, Class)
•    You may need to click on the name bar and
select size and bytes in order to see these
parameters

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
4- Current Directory
window

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
4- Current Directory Window

• The current directory window is a list of
files.

• When you try to load information from a
file or try to save information – MATLAB
uses the current directory.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
5- Document Window

• If you double click on any variable in the
workspace window MATLAB launches a
document window containing the array
editor.

• You can edit variables in the array editor.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
5- Document Window

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
6- Figure Window

• When Figures are created a new
window opens.
• It’s extremely easy to create graphs in
MATLAB.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Plotting x versus y.

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
6- Figure Window

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
7- Editing Window

• This window allows you to type and save a
series of commands without executing them.
• There are several ways to open an editing
window:
• With the new file icon

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Open an editing window
from the file menu or with
the new file icon

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University
Save and Run

Write your code in the editing window,
then run it using the Save and Run icon

Dr Simin Nasseri, Mechanical Engineering Technology Department,
Southern Polytechnic State University

```
To top