Presentation is loading. Please wait.

Presentation is loading. Please wait.

EGR 115 Introduction to Computing for Engineers Introduction to Computer Programming Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers.

Similar presentations


Presentation on theme: "EGR 115 Introduction to Computing for Engineers Introduction to Computer Programming Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers."— Presentation transcript:

1 EGR 115 Introduction to Computing for Engineers Introduction to Computer Programming Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers

2 Lecture Outline Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers Introduction to Programming  Why learn programming?  A first example  How to access MATLAB Slide 2 of 12

3 Introduction to Computer Programming Why Learn Programming? Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers As engineers it is often more cost effective for us to “simulate” complex systems before implementation  Simulate = computer programming!!!  Testing on a simulated system is cheaper than building hardware  A system failure on a simulated system is less catastrophic than failure of hardware!!  The fidelity of the simulation determines the accuracy of the results  Most complex systems involve significant software (i.e., programming!!)  Analyzing the results of a test often involves programming!! Slide 3 of 12

4 Introduction to Computer Programming Why Learn Programming? Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers It is often faster to write a program to automate a tedious/repetitive task (10x faster!!) Embedded computers are everywhere  Modern automobiles contain up to 50 microprocessors o They all require programming!! The software that runs the Boeing 787 has approximately 7 million lines of code Programming is a critical skill for engineers today and even more so tomorrow 100 M  The Chevrolet Volt has more lines of code than a Boeing 787!!! Future version will have up to 100 M lines of code!! Slide 4 of 12

5 Introduction to Computer Programming A First Example: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers A First Example Problem:  Design the suspension for an small car. o Select the shock absorber and spring so that the oscillations “diminish” after about 4 seconds.  Consider just one corner (i.e. 1 wheel) o Viscous damping of shock is “c” o Spring constant is “k” o Displacement is “X” o External force is “F”  Mathematical dynamic model F X Slide 5 of 12

6 Introduction to Computer Programming A First Example: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers Slide 6 of 12

7 Introduction to Computer Programming A First Example: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers Develop a “simple” MATLAB program to simulate the displacement vs time (i.e., system’s response)MATLAB program Define constants Compute parameters Calculate response Plot results Slide 7 of 12

8 Introduction to Computer Programming A First Example: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers Results: C = 10 C = 100 C = 50 Looks like a shock with damping of 50 N / (m/s) will do the job!!! Slide 8 of 12

9 Introduction to Computer Programming How to Access MATLAB: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers 1.MATLAB can be found on ERAU computers at:  All Programs  College of Engineering  MATLAB  We are currently using version 2013b 2.MATLAB can also be accessed via ERNIE:ERNIE  For home use (slow) 3.Can be purchased from the bookstore for ~$99 Slide 9 of 12

10 Introduction to Computer Programming The Advantages & Disadvantages of MATLAB: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers AdvantagesDisadvantages Ease of use Interpreted, allows interactive prototyping, and debugging Speed The interpreted nature of MATLAB makes it inherently slower to execute than some other languages Tools exist to speed up MATLAB code above interpreted speed Speed is frequently not important in experimental code Platform Independence Same MATLAB code can be executed on a broad range of machines and will provide identical results Predefined Functions Libraryof commonoperations(e.g., sin,…) Toolboxes forspecificapplications Cost Typically 10Xmore expensive MATLAB is not an open standardand is asingle-source vendor (i.e. MathWorksInc.) Device-Independent Plotting Allows visualization of results across many platforms (e.g., MAC, Linux, …) Graphical User Interface Can develop GUI for programs Memory MATLAB typically uses more memory than comparable programming languages MATLAB Compiler Stand-alone & Java-likep-code Slide 10 of 12

11 Introduction to Computer Programming History of MATLAB: Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers MATLAB is an acronym for MATrix LABoratory  Simplifies programming with arrays (i.e., matrices and vectors) Development of MATLAB was begun by Dr. Cleve Moler, a CS professor from UNM, in the late 70’s.  For teaching programming to engineers MathWorks was founded in 1984  In 2004 MATLAB had over 1 million users Slide 11 of 12

12 Next Lecture Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers Introduction to MATLAB  The Environment  Using MATLAB as a Calculator Slide 12 of 12


Download ppt "EGR 115 Introduction to Computing for Engineers Introduction to Computer Programming Wednesday 27 Aug 2014 EGR 115 Introduction to Computing for Engineers."

Similar presentations


Ads by Google