Professional Documents
Culture Documents
Chapter 1
1 22.11.22
Objectives
After studying this chapter you should be able
to:
Understand what MATLAB is and why it is
widely used in engineering and science
Understand the advantages and limitations
of the student edition of MATLAB
Formulate problems by using a structured
problem-solving approach
2 22.11.22
What’s in this Chapter?
What is MATLAB?
Student Edition of MATLAB
How is MATLAB used in industry?
Problem Solving in Engineering and
Science
3 22.11.22
Section 1.1
What is MATLAB?
MATLAB is one of a number of commercially
available, sophisticated mathematical
computation tools
Others include
Maple
Mathematica
MathCad
4 22.11.22
MATLAB excels at:
Numerical calculations
Especially involving matrices
Graphics
MATLAB stands for
Matrix Laboratory
5 22.11.22
Why MATLAB
Easy to use
Versatile
Built in programming language
Not a general purpose language like C++ or
Java
6 22.11.22
MATLAB was originally
written in Fortran, then
later rewritten in C
7 22.11.22
MATLAB 8
MATLAB is updated regularly
Versions that predate
MATLAB 5.5 are substantially different
MATLAB 8 was introduced in late 2012, and
features a new interface
8 22.11.22
Release Numbers
The Mathworks packages their software in
groups, called releases
Release 2013a includes
MATLAB 8.1
Simulink
A number of specialized “toolboxes”
9 22.11.22
Releases
New releases are issued twice a year in the
spring and in the fall
10 22.11.22
Section 1.2
Student Edition of MATLAB
MATLAB comes in both a student and
professional edition
Student editions are available for
Windows Operating Systems
Mac OS
Linux
11 22.11.22
The student edition of release
2013a includes
Fullfeatured MATLAB 8.1
Simulink
Symbolic toolbox based on MuPad
Limited number of other commonly used
toolboxes
12 22.11.22
The command prompt is the
biggest difference you’ll notice
13 22.11.22
Section 1.3
How is MATLAB used in Industry?
14 22.11.22
Electrical Engineering
15 22.11.22
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.
16 22.11.22
Fluid Dynamics
17 22.11.22
Section 1.4
Problem Solving in Engineering and
Science
1. State the Problem
2. Describe the input and output
3. Develop an algorithm
4. Solve the problem
5. Test the solution
18 22.11.22
State the Problem
If you don’t have a clear understanding of the
problem, it’s unlikely that you’ll be able to solve
it
Drawing a picture often helps you understand
the system better
19 22.11.22
Describe the Input
and Output
Be careful to include units
Identify constants
Label your sketch
Group information into tables
20 22.11.22
Develop an Algorithm
Identify
any equations relating the knowns and
unknowns
Work through a simplified version of the
problem by hand or with a calculator
Developing a flow chart is often useful for
complicated problems
21 22.11.22
Solve the problem
Create a MATLAB solution
Be generous with comments, so that others
can follow your work
22 22.11.22
Test the Solution
Compare to the hand solution
Do your answers make sense physically?
Is your answer really what was asked for?
Graphs are often useful ways to check your
calculations for reasonableness
23 22.11.22
If you use a consistent problem solving strategy
you increase the chance that your result is
correct
Here’s an example….
24 22.11.22
Example 1.1
Albert Einstein
E=mc2
The sun is fueled by
the conversion of
matter to energy
How much matter does
the sun consume every
day?
25 22.11.22
State the Problem
Find the amount of matter necessary to
produce the amount of energy radiated by the
sun everyday
26 22.11.22
Describe the Input
and Output
Input
Rate of energy radiation
E = 385*1024 Joules/second
Speed of light
c = 3.0*108 meters/second
Output
Mass in kilograms
27 22.11.22
Develop an Algorithm – Hand
Example
The energy radiated in one day is:
J sec hours
385 10 24
3600 24 * 1 day 3 . 33 10 31
J
sec hour day
3 . 33 10 31
J J
m 3 . 7 10 14
3 . 0 10 m / sec
8 2
m 2 / sec 2
28 22.11.22
But the units are wrong!!
J
3.7 1 0 14
2 2
m / sec
1 J = 1 kg m2/sec2
2 2
kg m / sec
3 . 7 10 14
2 2
3 . 7 10 kg
14
m / sec
29 22.11.22
Develop a MATLAB Solution to
Solve the Problem
We’llstart learning the details of how to
use MATLAB in the next chapter.
However, you can see from the following
demonstration just how easy it is to use
the command window
30 22.11.22
Enter theyou
Notice
Now
Once
NowOnce value
that
enter
enter hit forthe
the
the Eenter
Enter theagain,
value for c,
at key,
the command
value ofprogram
equation
equation
the
result isEtoto
ischange
calculate
repeated
the speed of light
prompt
updated
the
repeats
the masstobased
energy
back your yourateinon
input.from
the
your
Notice
kJ/day calculation
the
command to use
kJ/s. of
window
scientific notation in the
result
31 22.11.22
Test your Solution
Matches the hand solution
Is it reasonable?
Consider…
Mass of the sun = 2*1020 kg
How long would it take to consume all that mass?
32 22.11.22
time = (mass of the sun)/(rate of consumptio
2 10 30
kg year
time * 1 . 5 10 13 years
3 . 7 10 14 kg / day 365 days
33 22.11.22
Summary
MATLAB is widely used
MATLAB is easy to use
A systematic problem solving strategy makes it
more likely you’ve found the right answer
34 22.11.22