es 100: introduction to engineering use of the computer

24
ES 100: Introduction to Engineering Use of the Computer 1. Log in using your Novell password. If you do not know your password, immediately (now!) see Al Bender in room 342 upstairs. 2. Open MATLAB once you have logged in. 3. A quiz will be given at the end of class.

Upload: cameron-gaines

Post on 02-Jan-2016

25 views

Category:

Documents


0 download

DESCRIPTION

ES 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. Welcome to the New Course!. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: ES 100: Introduction to Engineering Use of the Computer

ES 100: Introduction to Engineering Use of the Computer

1. Log in using your Novell password. If you do not know your password, immediately (now!) see Al Bender in room 342 upstairs.

2. Open MATLAB once you have logged in.

3. A quiz will be given at the end of class.

Page 2: ES 100: Introduction to Engineering Use of the Computer

Welcome 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

Page 3: ES 100: Introduction to Engineering Use of the Computer

Course 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.

Page 4: ES 100: Introduction to Engineering Use of the Computer

More 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.

Page 5: ES 100: Introduction to Engineering Use of the Computer

Course ObjectivesThe 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

Page 6: ES 100: Introduction to Engineering Use of the Computer

MATLAB characteristicsAdvantages of MATLAB for Programming

Ease of UseConvenient editor with automatic formattingPlatform IndependencePredefined FunctionsDevice-Independent PlottingGraphical User InterfacesMATLAB Compiler AvailableSame Tool for Many Uses

Disadvantages of MATLAB for ProgrammingInterpreted (can be slow), Cost

Page 7: ES 100: Introduction to Engineering Use of the Computer

C o m m a n d H i s t o r y w i n d o w d i s p l a y s p r e v i o u s c o m m a n d s

C u r r e n t D i r e c t o r y B r o w s e r s h o w s f i l e s i n c u r r e n t d i r e c t o r y

L a u n c h P a d s h o w s a t r e e o f d o c u m e n t a t i o n , d e m o s , a n d t o o l s f o r e a c h p r o d u c t

T h i s c o n t r o l a l l o w a u s e r t o v i e w o r c h a n g e t h e c u r r e n t d i r e c t o r y

M A T L A B C o m m a n d W i n d o w

W o r k s p a c e B r o w s e r s h o w s v a r i a b l e s d e f i n e d i n w o r k s p a c e

L a u n c h t h e H e l p B r o w s e r

The MATLAB DesktopSet to where youwant to store your work(recommend U: Drive)

Page 8: ES 100: Introduction to Engineering Use of the Computer

Make 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.

Page 9: ES 100: Introduction to Engineering Use of the Computer

The Command Window

Page 10: ES 100: Introduction to Engineering Use of the Computer

The 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

Page 11: ES 100: Introduction to Engineering Use of the Computer

>>a=1>>b = 3>>a+b>>whos>>a>>b>>ans>>c>>a = 2>>c = a*b>>a*sqrt(b)>>▲ (up arrow)>>a*sqrt(c)>>a = a + 1>>clc

Enter the following commands into MATLAB

Page 12: ES 100: Introduction to Engineering Use of the Computer

The Workspace Window

• Shows properties of variables

• Can be used to edit values of variables (double click to activate array editor)

Page 13: ES 100: Introduction to Engineering Use of the Computer

The 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

Page 14: ES 100: Introduction to Engineering Use of the Computer

The Launch Pad.

Page 15: ES 100: Introduction to Engineering Use of the Computer

The Command History Window

Double click on any command to repeat it in the Command Window

Page 16: ES 100: Introduction to Engineering Use of the Computer

The 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!

Page 17: ES 100: Introduction to Engineering Use of the Computer

Exercise using MATLAB’s Editor

Click on Start (in MATLAB), Desktop Tools, Editor and enter the following:

% Tree Measurement, dbh = Diameter at Breast Height (that’s how foresters

% measure trees)

dbh = 24

area=(dbh^2)*pi/4

circ=dbh*pi

myStringArea=[‘The tree’s area is ‘ num2str(area)]

myStringCirc=[‘The tree’s circumference is ‘ num2str(circ)]

disp(myStringArea)

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

Page 18: ES 100: Introduction to Engineering Use of the Computer

MATLAB 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

Page 19: ES 100: Introduction to Engineering Use of the Computer

MATLAB plot of sin x versus x.

Page 20: ES 100: Introduction to Engineering Use of the Computer

Plotting Exercise

Enter the following into the Command Window

>>a = [1 2 3 4 5 6];

>>b=a.^2;

>>plot(a,b);

>>bar(a,b);

See how the figure changed.

>>scatter(a,b);

See how the figure changed.

Page 21: ES 100: Introduction to Engineering Use of the Computer

Exercise 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:

>>plot(a,b);

>>b=a.^2;

>>plot(a,b);

Page 22: ES 100: Introduction to Engineering Use of the Computer

The Help Browser

Page 23: ES 100: Introduction to Engineering Use of the Computer

The Path Tool

This is where you tell MATLAB where to look for m files when they are named in the Command Window.

Page 24: ES 100: Introduction to Engineering Use of the Computer

Assignment 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 & 2Note: 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.