Ch02 Environment 3rd Ed
Ch02 Environment 3rd Ed
Chapter 2
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited
reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying,
recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department, Pearson Education,
Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Objectives
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• Define and use simple matrices
300 • Name and use variables
• Understand the order of operations in MATLAB
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Objectives - continued
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
• Save a series of commands in an M-file
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change In this chapter we’ll…
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
MATLAB
• Learn how to save our work
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Section 2.1
Getting Started
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
MATLAB opens to a default
window configuration
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
• MATLAB uses a
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
standard
windows menu
bar
100
200
300
• To exit MATLAB
400
use the close
icon
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Section 2.2
MATLAB Windows
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• They are not necessarily all open
300
400
at once
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
Workspace Window
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
Current Folder
Window
Lists files stored in the Command Window
current directory
100 Enter commands at the prompt
200
MATLAB Windows
300
400
500
Command
100 200 300 400 500
History Window
Records all commands
issued in the command
window – including
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,mistakes
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Let’s look at the windows
one at a time
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Command Window
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
commands
100
• You can retype them or use the arrow
200
300
keys to retrieve commands and edit
400
500
them before hitting enter again
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Command History
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
window, or when you issue the clc
Command History
300
400
command, the command window
500
100 200 300 400 500
is cleared
• But the command history remains
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Command History
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
400
500
100 200 300 400 500
window
• You can edit the command before
executing
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Workspace Window
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
Workspace Window
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
500
100 200 300 400 500
window
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
Scalar
100
200 Vector
300
400
500
100 200 300 400 500
2-D
Matrix
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Current Directory/Folder
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
of files
• When you try to load information
100
200
from a file or try to save
300
400
information – MATLAB uses the
500
100 200 300 400 500
current folder
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Document Window
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
500
100 200 300 400 500
• You can edit variables in the array
editor
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
New Variable
-5
Rate of Change Icon
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
displays the variable
300
400
editor
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Figure Window
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
window opens
• It’s extremely easy to create
100
200
graphs in MATLAB
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
500
100 200 300 400 500
Note: The semicolon
suppresses the output from
each command
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
graphs by adding
•Titles
•Axis labels
100
200
•Legends
300
•Other types of annotations
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Editing Window
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• There are several ways to open
300
400
an editing window
500
100 200 300 400 500
– From the file menu
– With the new file icon
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
Open an editing window
300
from the file menu or with
400 the new file icon
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
Write your code in the editing window,
then run it using the Save and Run icon
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Section 2.3
-5
-4.5
Rate of Change
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• We need to understand how
300
400
MATLAB works to solve more
500
100 200 300 400 500
complicated problems
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Variables
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
value to a variable
• A=3
100
200
• Should be read as A is assigned a
300
400
value of 3
• Use the variables in subsequent
500
100 200 300 400 500
calculations
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Naming Variables
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• Names are case sensitive
• There are certain keywords you
300
400
500
can’t use
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Use the iskeyword function
for a list of keywords
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
iskeyword
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
ans =
'break' 'global'
'case' 'if'
'catch' 'otherwise'
'classdef' 'parfor'
100
'continue' 'persistent'
200
'else' 'return‘
300
'elseif' ‘spmd’
400
'end‘ 'switch'
'try'
500
100 200 300 400 500
'for‘
'function' 'while'
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
You can reassign function
names
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• sin = 3 changes sin from a
300
400
function to a
500
100 200 300 400 500
variable name
• clear sin resets sin back to a
function
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Practice Exercise 2.2
Which of these names are allowed
-5
-4.5
Rate of Change
in MATLAB?
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• test
• Test
• if
x
• x
my-book
100
• my_book
200
• Thisisoneverylongnamebutisitstillallowed?x
•
300
400
x
1stgroup
500
100 200 300 400 500
• group_one
• zzaAbc
• z34wAwy?12#
x x
• sin bad
• log idea
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
2.3.2 Matrices in MATLAB
The basic data type
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
– Matrix with one row and one column
• Vector (One dimensional matrix)
300
400
500
-4.5
Rate of Change Scalar Calculations
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
use a calculator
100 Command
200
Prompt
300
400
500
100 200 300 400 500
>> 9 + 10
ans=19
Result
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Assignment Operator
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
type
a=1+2
100
200
which should be read as:
300
400
“a is assigned a value of 1+2 “
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
How is the assignment operator
-5
-4.5
Rate of Change
-4
-3.5
-3
-2.5
-2
-1.5
-1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
x=3+5
means that both sides are the same
• In computers when we say
100
x=3+5
200
300
we are telling the machine to store the
400
value on the right hand side of the
500
100 200 300 400 500
equation in a memory location, and to
name that location x
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Is that really different?
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
• Yes!!!
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
it means replace the value in the
400
memory location named x, with a new
value equal to x+1
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Order of Operation
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
class
• Same as your calculator
100
200
– Parentheses first
300
400
– Exponentiation
– Multiplication / division
500
100 200 300 400 500
– Addition / subtraction
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Order of Operation
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
5*(3+6) = 45
time, hour
5*3+6 = 21
100
200
300
White space does not matter!!!
400
500
5*3 + 6 = 21
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Parentheses
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
• Use only ( )
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• MATLAB does not assume
300
400
operators
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Compute from left to right
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
5*6/6*5 = 25
5*6/(6*5) = 1
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Here’s an example
Find the surface area of a cylinder
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
r = radius h = height
-2
-1.5
-1
r=5 h = 10
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
π r2
2π r * h
100
200
300 π r2
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Array Operations
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
You may use either a space or a
comma as a “delimiter” in a row
300
400
500
vector
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
Use a semicolon as a delimiter to create a
new row
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
Hint: It’s easier to keep track of how many
values you’ve entered into a matrix, if you
enter each row on a separate line. The
semicolons are optional
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Shortcuts
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
500
or the command
100 200 300 400 500
b = [1:5]
both return a row matrix
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
The default increment is 1, but if you
want to use a different increment put
it between the first and final values
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
To calculate spacing
between elements use…
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
• linspace
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• logspace
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5
time, hour
3 3.5 4 4.5 5
number of elements in the
array
Initial value in the
Final value in the
array
array
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
-4.5
Rate of Change Hint
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• For example
300
400
500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Mixed calculations between
scalars and arrays
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• Multiplication and division are a little
300
different
• In matrix mathematics the
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
Multiplication between
arrays is performed on
corresponding elements if
the .* operator is used
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
-4.5
Rate of Change Array Operations
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
• Array multiplication .*
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• Array division ./
• Array exponentiation .^
100
200
300
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
The matrix capability of MATLAB makes it
easy to do repetitive calculations
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
– Perform the calculation
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
-4.5
Rate of Change More about pi
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
• If you find sin(pi) MATLAB returns a
very small number.
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Transpose
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
The transpose operator
500
100 200 300 400 500
makes it easy to create
tables
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
The transpose
100
operator works on both
200
one dimensional and
300 two dimensional arrays
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Number Display
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
• Scientific Notation
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
500
are designated with an e between the
decimal number and exponent. (Your
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
It is important to omit blanks between
200 the decimal number and the exponent.
300 For example, MATLAB will interpret
400
6.022 e23
500
100 200 300 400 500
as two values (6.022 and 1023 )
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Display Format
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
• MATLAB handles both integers and
decimal numbers as floating point
500
100 200 300 400 500
numbers
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Default
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• If an integer is entered it is
displayed without trailing zeros
100
200
• If a floating point number is
300
400
entered four decimal digits are
displayed
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Other formats
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
subsequent displays
– format long results in 14 decimal
100
digits
– format bank results in 2 decimal
200
300
digits
400
500
100 200 300 400 500
-4.5
Rate of Change
Really Big and Really Small
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Common Scale Factor
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
500
100 200 300 400 500
values.
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
Common Scale
Factor
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Two other formats
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
• format +
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• format rat
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Spacing in the command
window
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
400
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Section 2.4
Saving Your Work
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
Variables are saved,
300 not the commands in
400
500
the command window
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
Save with a command in the
command window
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
MATLAB automatically
saves to a .mat file
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
500
100 200 300 400 500
Again – Remember that the only things being saved are the
values stored in the workspace window – not the commands
from the command window
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Script M-files
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
• File->New->M-file
300
400
• Type your commands in the edit
window that opens
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
current folder/directory
• It runs in the command window
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5
time, hour
3 3.5 4 4.5 5
Save the file using
the save icon, or the
file menu
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
100
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
This arrangement is
often easier to use
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
example.m
time, hour
100
200
300
400
When I
500
100 200 300 400 500
execute the
file, the figure
appears on
top of the
MATLAB
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
desktop
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
300
400
500
100 200 300 400 500
-4.5
Rate of Change Comments
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
300
400
– Assignment #
500
100 200 300 400 500
– Descriptions of what you are doing
and why
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
Rate of Change
-5
-4.5
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Cell Mode
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
300
500
100 200 300 400 500
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Cell Toolbar
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
100
200
Cell Dividers
300
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Summary
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
300
400
500
100 200 300 400 500
• The use of cell mode
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Example
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
need to understand how gases
300
400
behave. The basic equation describing
500
100 200 300 400 500 the properties of gases is the ideal gas
law, a relationship studied in detail in
freshman chemistry classes.
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Continue…
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• PV = nRT
• Where P in kPa
• V in m3
100
200
300
400
500
100 200 300 400 500
• n = number of kmoles of gas
• R in kPa m3/kmol K
• T in kelvins (K)
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Continue…
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
• n = m / MW
• m in kg
• MW in kg/kmol
100
200
300
400
500
100 200 300 400 500
• What happen if different units is
used????
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.
-5
-4.5
Rate of Change Continue…
Rate of temperature change, degrees/hour
-4
-3.5
-3
-2.5
-2
-1.5
-0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time, hour
200
pressure is 100 kPa. The average
300
400
molar mass of air is approximately 29
500
100 200 300 400 500 kg/kmol. Find the mass of the air in the
wind tunnel.(Use the problem-solving
methodology)
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
This material is protected by Copyright and written permission should be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For
information regarding permission(s), write to:
Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.