Title: ES 100: Introduction to Engineering Use of the Computer
1ES 100 Introduction to Engineering Use of the
Computer
- Log in using your Novell password. If you do not
know your password, immediately (now!) see Al
Bender in room 342 upstairs. - Open MATLAB once you have logged in.
- A quiz will be given at the end of class.
2Welcome to the New Course!
- ES 100 has been substantially revamped as part of
an NSF grant entitled Hands-On Learning in
Engineering - Twelve sections of hands-on lecture/lab (Meets
two times per week) - Twelve sections of lab experiments and data
collection (Meets four times during the semester) - You need to be signed up for one section of each
3Course Information
- Attendance is required at all lecture/labs and
all experiments and will be tracked with
Blackboard. - Every class will include a brief quiz on
Blackboard near the beginning of class. The
lowest five of these will be dropped. There will
be no make-up for quizzes. - There will be homework assigned for every class.
Each of the four lab experiments will have an
associated group assignment.
4More course information
- Grading will be as follows
- 10 Attendance (taken via Blackboard)
- 60 Quizzes (Via Blackboard, every class, lowest
three dropped) - 30 Lab Exercises Reports (written group
reports) - You will be asked from time to time to fill out a
questionnaire. They are not mandatory and will
not be used in grading.
5Course Objectives
- The general objectives of this course are to
- Learn how to use MATLAB as a computer programming
tool. - Learn how to create simple algorithms and program
them to solve problems of engineering interest. - Learn about the application of computers in
laboratory experiments using LabVIEW - Use MATLAB to manage data and compare results
from experiments and mathematical models - Have fun while learning this useful tool
6MATLAB characteristics
- Advantages of MATLAB for Programming
- Ease of Use
- Convenient editor with automatic formatting
- Platform Independence
- Predefined Functions
- Device-Independent Plotting
- Graphical User Interfaces
- MATLAB Compiler Available
- Same Tool for Many Uses
- Disadvantages of MATLAB for Programming
- Interpreted (can be slow), Cost
7The MATLAB Desktop
Set to where you want to store your
work (recommend U Drive)
8Make the following changes in MATLAB now
- Change the Current Directory to your U drive.
(Click on the ... button, click on the U drive
with your name on it, click on OK.) This is
where you want to save your classwork because it
can be accessed anywhere in the world. You may
want to create a new folder named ES 100. - Go to File, Preferences, Command Window and
change the Numeric display to compact.
9The Command Window
10The Command Window
- This is where you can work interactively with
MATLAB - Some commonly used commands
- ? (up arrow) -- returns the previous command.
Can be repeated to obtain earlier commands. - clc clears the screen but not the memory
- whos shows list of variables and their
properties - clear clears the memory but not the screen
11Enter the following commands into MATLAB
gtgta1 gtgtb 3 gtgtab gtgtwhos gtgta gtgtb gtgtans gtgtc gtgta
2 gtgtc ab gtgtasqrt(b) gtgt? (up
arrow) gtgtasqrt(c) gtgta a 1 gtgtclc
12The Workspace Window
- Shows properties of variables
- Can be used to edit values of variables (double
click to activate array editor)
13The Array Editor is invoked by double-clicking a
variable in the Workspace Browser. It allows a
user to change the values contained in a variable
or array.
The Array Editor
14The Launch Pad.
15The Command History Window
Double click on any command to repeat it in the
Command Window
16The Edit/Debug Window
- This is where you write, edit, test and debug
your programs (script or m files) - You will be using this window A LOT!
17Exercise using MATLABs Editor
Click on Start (in MATLAB), Desktop Tools, Editor
and enter the following Tree Measurement, dbh
Diameter at Breast Height (thats how
foresters measure trees) dbh
24 area(dbh2)pi/4 circdbhpi myStringAreaTh
e trees area is num2str(area) myStringCircT
he trees circumference is num2str(circ) disp(m
yStringArea) disp(myStringCirc) Save as tree.m,
execute tree in the Command Window, examine
output, add semicolons to tree.m in the Editor,
save, rerun in Command, examine
18MATLAB plotting
- Matlab has excellent plotting capabilities
- You can create and format a plot from the command
widow - You can also create and format plots from your
program - Unless you are creating a program, it is easier
to format a plot in the plot window
19MATLAB plot of sin x versus x.
20Plotting Exercise
Enter the following into the Command Window gtgta
1 2 3 4 5 6 gtgtba.2 gtgtplot(a,b) gtgtbar(a,b)
See how the figure changed. gtgtscatter(a,b) See
how the figure changed.
21Exercise using Array Editor
In the Workspace window double click on the
variable a Edit the last value to be 8 Go to the
Command window and type a to show that its last
value was changed Type b to show that its
values have not changed Compare the plots without
and with b updated gtgtplot(a,b) gtgtba.2 gtgtplot(
a,b)
22The Help Browser
23The Path Tool
This is where you tell MATLAB where to look for m
files when they are named in the Command Window.
24Assignment for next lecture
- Do problems 1.5, 1.6, 1.7, 1.8 yourself. The
only way to learn how to use software is lots of
practice. - Write GPP/PP into a word file for chapters 1 2
- Note GPP Good Programming Practice
- PP Potential Pitfalls
- Read all of Chapter 1 and sections 2.1-2.5,2.8,
2.9 - Be prepared for a quiz at the beginning of the
next class, based on this assignment. This will
also serve to take attendance. -