# Introduction to MATLAB 7 by malj

VIEWS: 15 PAGES: 22

• pg 1
```									Introduction to
MATLAB 7
Engineering 161
Engineering Practices II
Joe Mixsell Spring 2012
MATLAB Properties I
• MATLAB is a very powerful mathematical
computational tool.
• MATLAB comes from MATrix LABoratory
• MATLAB provides extensive capabilities
for generating graphs
• MATLAB is applicable to a broad range of
engineering problems
MATLAB Properties II
• MATLAB supports an interactive and a
programming environment
• Think of the interactive environment as a
“super calculator” with graphics
• Think of the programming environment as
tool for writing programs to perform
complex calculations
MATLAB Properties III
• Where does MATLAB fit?
– It is usually easier to write programs in
MATLAB as compared to C or Fortran
– C or Fortran programs will usually run faster
than MATLAB programs
– But, MATLAB is optimized for matrix
manipulations and programs formalized in this
way will run faster than similar programs in C
or Fortran
Resources
• Text: MATLAB for Engineers
• Notes: MATLAB Notes and
Assignments
• Website:
rses/engr161.cfm
• Website: www.mathworks.com

• Student Edition of MATLAB 7 (\$99)
• Computer Lab
Course of Study
•   MATLAB Environment                         Chp. 2
•   Built-In MATLAB Functions                  Chp. 3
•   Manipulating MATLAB Matrices               Chp. 4
•   Plotting                                   Chp. 5
•   User Defined Functions                     Chp. 6
•   User Controlled Input and Output           Chp. 7
•   Logical Functions and Control Structures   Chp. 8 and 9
•   Matrix Algebra                             Chp. 10
•   Symbolic Mathematics                       Chp. 12
•   Polynomials/Curve Fitting                  Slide set
MATLAB Assignments
•   Chp. 2: 2.9, 2.11, 2.13, 2.17 and 2.18
•   Chp. 3: 3.5, 3.10, 3.22, 3.23
•   Chp. 4: 4.1, 4.8, 4.12
•   Chp. 5: 5.11, 5.13, 5.20, 5.25, 5.27
•   Chp. 6: 6.2, 6.6, 6.8
•   Chp. 7: 7.5 and 7.6, 7.9, 7.12, 7.13, 7.15
•   Chp. 8 & 9: 8.4, 8.5, 8.14, 9.8, 9.13, 9.15, 9.16
•   Chp. 10: 10.18, 10.20
•   Chp. 12: 12.7, 12.9 and 12.10, 12.11, 12.15, 12.16, 12.29, and
12.30
Programming Assignment- Project #1

• There will be three longer programming projects
which will be assigned and discussed in class later
in the semester, usually after the first exam. You
will have two weeks to complete each project and
turn in your work for credit.
Programming Assignment- Project #2
Programming Assignment- Project #3
Assignments
• The percent symbol % is used to define a
comment, use this following the MATLAB

>>% Joe Mixsell
>>% Assignment 3.4
Assignments

• Many assignment require you to print the
Edit window, the Command Window and the
Figure window(s). Just print them all and
staple them together when you turn them
in. Remember to clear the command
a clean slate.
More on Assignments
• The first few assignments can easily
be done with paper and pencil and a
calculator but you need to do them
using MATLAB. Only outputs from
MATLAB will be accepted.
An Engineering Problem-Solving Methodology

• Step 1: State the problem clearly.
• Step 2: Describe the inputs and outputs.
• Step 3: Work the problem by hand with a
set of simple data.
• Step 4: Develop the MATLAB solution
• Step 5: Test the solution with real data
Getting Started
Example 1
d = ½ * g * t^2

where d is the distance a body falls freely in a gravitation field during t
seconds.

Example 2
x(t) = exp (-alpha * t ) * cos ( omega * t )

i.e, our suspension system we studied previously briefly using Excel
Example I
• Using MATLAB we want to create a
table of values of time and distance
for time increments between 0 and
10 seconds.
Example II
• Using MATLAB we’ll do an analysis of
a suspension system and plot position
versus time as the system responds
to an initial displacement.
Continuing with today’s
Discussion
•   MATLAB Help and Demos
•   Introduce various MATLAB windows
•   Use the Command Window
•   Use the Edit Window
•   View results in the Command Window
and the Graphics Window
Discussion Next Class- Chapter 2-
MATLAB Environment
•   MATLAB variables
•   Working with Matrices
•   Scalar Operations
•   Precedence of Arithmetic Operators
•   Array Operations
– Saving Variables
– M-files (Writing and saving programs)
MATLAB Discussion Sequence

We will complete Chapters 2, 3, 4 and 5 for our
first exam. Then introduce material from
Chapters 6, 7 and 8 for several programming
topics (functions, input statements, for loops and
if statements ). At this point the first
programming project will be assigned. Then we
will complete the material in these Chapters.
Scheduling our Midterm

• Assume we’ll set the midterm date to be in early
to mid part of March. It will include Excel,
Powerpoint and MATLAB up and including Chapter
5. Remember assignments in Excel and MATLAB
through Chapter 5 due at first exam.
• We’ll finalize the date in a couple weeks.
And now . . .

OFF TO MATLAB…

Learn by doing . . .

```
To top