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.
Published byModified over 4 years ago
Presentation on theme: "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."— Presentation transcript:
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.
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
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.
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.
Course 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
MATLAB 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
The MATLAB Desktop Set to where you want to store your work (recommend U: Drive)
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.
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
>>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
The Workspace Window Shows properties of variables Can be used to edit values of variables (double click to activate array editor)
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
The Command History Window Double click on any command to repeat it in the Command Window
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!
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
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
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.
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);
The Path Tool This is where you tell MATLAB where to look for m files when they are named in the Command Window.
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 & 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.