Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
EGR 106 Intro to Engineering II • Engineering problem solving using MATLAB • Text: Amos Gilat, MATLAB An Introduction with Applications, Wiley 2004 ISBN 0-471-43997-5 Instructor EGR 106 Section 7 • • • • • Richard Brown, Department of Chemical Engineering, 110 Crawford Hall Office hours Tue-Thur 11 -12pm [email protected] 874-2707 (Office) Grading • • • • • Attendance 15% IMPORTANT SIGN IN ALL CLASSES!!!! Homework 15% 3 Quizzes 40% Team project 30% Homework • • • • • • • 15% of your grade No partial credit Done during lab. If you can not solve a problem, get help. 10 point scale for each assignment Late home work penalty is 2 points Not accepted after one week. Engineering Computer Lab - ECL • To use the ECL you will need the username and password provided to you by the College of Engineering when you started. • If you cannot remember your username and password for access to ECL computers, stop by the HELP desk TODAY after class and request one be issued to you. You will need it for next Tuesdays class. Computation • What is computation? • Examples: 3+2 tan 40o • Computation = “transformation from one or more inputs to an output” Computer Computation • Very fast at arithmetic operations • Large numbers of repetitive operations quickly • Algorithms = computer programs – Need to understand what computations are “simple” for the computer – Need to write a clear set of directions to be followed – Build more complicated computations from intermediate ones Algorithms • Definition: “a set of directions for carrying out a computation in terms of other, simpler computations” • “Simpler computations” = ones that we already know how to do MATLAB – What is it ? • Name is from matrix laboratory - uses matrices or rows and columns of numbers. • Powerful tool for – Computation and visualization of engineering and science mathematics – Communication of ideas – Programming: • Built-in editor, debugger, and help • Many predefined functions (grouped in toolboxes) • Interpreted or compiled programs The Command Window • Command prompt >> • Basic math operations are available: addition + subtraction – division / multiplication * exponentiation ^ “enter” key “executes” or “runs” or “invokes” the operation • Operator precedence: PEMDAS 5–4+3^4/(3–1)=? Arithmetic Operations • • • • • • Addition Subtraction Multiplication Right Division Left Division Exponentiation + * / \ ^ 2+2 3-2 3*6 7/3 7\3 = 3/7 2^3 = 8 Precedence • Precedence is the order operations are preformed, remember PEMDAS • (3^2) anything in parentheses is done first • 5^2 exponentiation is next • 2*2 or 10/5 multiplication or division next • 1+1 or 5-3 addition or subtraction next • Operations are done from left to right Precedence Example • 2^(6/2) = 2^3 = 8 • 2^6/2 = 64/2 = 32 • Remember computer does what it is told rather than what you hope it should do. Some Syntax • • • • • Assignment operator = > x= 1; > x = 2*x+1; The value of x is 3 Remember when programming that assignment operators can be changed as a result of program actions, so be careful assigning constants. Predefined Variables • • • • • • • ans pi eps inf i j NaN p 2^(-52) about 2.22e-16 1/0 sqrt(-1) Same as i Not a number 0/0 Some Functions • Elementary Math, sqrt(x), exp(x), etc. • Trig, sin(x), cos(x), x is in radians • Rounding functions , round(x), etc DIFFUSION • What is diffusion? Transport of one atom, ion or molecule through a medium. • Applications of Diffusion. • Fuel Cells • Drug Delivery • Strengthening Metals. • Structural Failure. • Computer Manufacture. • Polymer and paint breakdown. • Separations FUEL CELL Proton Exchange Membrane (PEM Cell) Proton Diffusion 2H ++ O 2- H 0 2 Diffusion controls start up time and current produced Demonstrations • Matlab has a number of demonstration programs. • Often helpful to run then and also examine the programs – shown in command window. May provide some programming tips!!!