Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Engineering Computation with MATLAB First Edition by David M. Smith Chapter.

Slides:



Advertisements
Similar presentations
An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.
Advertisements

Lecture 14 User-defined functions Function: concept, syntax, and examples © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 6- 1.
Scripts and Flow Control. Scripts So far we have been entering commands directly into the command line But there is a better way Script files (and functions)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Indexing Structures for Files.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object, Object- Relational, and XML: Concepts, Models, Languages,
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 2: Input, Processing, and Output
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.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Guide To UNIX Using Linux Third Edition
Chapter 1 Program Design
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Part 1 Conditionals and Loops.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Digital Image Processing Lecture3: Introduction to MATLAB.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
A First Program Using C#
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Microsoft Visual Basic 2005: Reloaded Second Edition
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Introduction to M ATLAB EE 100 – EE Dept. - JUST.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
Covenant College October 7, Laura Broussard, Ph.D. Professor COS 131: Computing for Engineers Ch. 2: Getting Started with MATLAB.
Chapter 7 Section 6 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Chapter 19: Visual Lisp. After completing this Chapter, you will be able to do the following: What is AutoLISP Launching Visual LISP Terminology and Fundamental.
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 4 Applications of the Derivative.
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 8 Section 6 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Covenant College November 27, Laura Broussard, Ph.D. Professor COS 131: Computing for Engineers Chapter 5: Functions.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 5 Integration.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Chapter 6 Section 6 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Chapter 2 Principles of Programming and Software Engineering.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 2.1 MATLAB ® opening window.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Release Numbers MATLAB is updated regularly
An Introduction to Programming
Lecture 1: Introduction
CIS16 Application Development Programming with Visual Basic
Use of Mathematics using Technology (Maltlab)
Engineering Computation with MATLAB
Digital Image Processing
An Introduction to Programming
Presentation transcript:

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Engineering Computation with MATLAB First Edition by David M. Smith Chapter 2: Getting Started with MATLAB

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-2 Objectives – Programming Languages The fundamentals of programming include: ■ How to use abstraction to think in a general way about a collection of data and procedural steps ■ How to describe the solution of a problem as an algorithm ■ The three paradigms of computing and the position of MATLAB in that spectrum ■ Three aspects of the apparently simple task of assigning a value toa variable

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Programming Language Background Abstraction “expressing a quality apart from a particular implementation.” –“To convert from degrees Celsius to Kelvin, you add 273 to the temperature.” –“He drove home from the office.” Algorithm a sequence of instructions for solving a problem Programming Paradigms –“a set of assumptions, concepts, values, and practices that constitutes a way of viewing reality.”

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-4 Programming Paradigms Functional programming – every programming operation is actually implemented as a function call with no side effects Procedural programming – the basic programs or subprograms are sequences of operations on data items. Object-oriented programming (OOP) – characterized by the concept of encapsulating data items with the methods or functions that manipulate those data items.

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Basic Data Manipulation Assigning Values to Variables Syntax similar to conventional algebra; different meaning. z = x + y z = 4*x - y Algebraic interpretation: implied relationship between x and y by addition and simplification: 2y = 3x Programming: I changed my mind about what I wanted to store in the variable z. ( x and y must have values)

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-6 Summary – Programming Languages ■ Abstraction lets you refer to collections of data or instructions as a whole. ■ An algorithm is a set of instructions at an appropriate level of abstraction for solving a specific problem. ■ A data class describes the type of data and the nature of operations that can be performed on that data. ■ An object is a specific instance of a class with specific values that can be assigned to a variable.

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-7 Objectives – the MATLAB User Interface ■ How to use the Command window to explore single commands interactively and how to recall earlier commands to be repeated or changed ■ Where to examine the variables and files created in MATLAB ■ How to view and edit data tables created in MATLAB ■ How MATLAB presents graphical data in separate windows ■ How to create scripts to solve simple arithmetic problems

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-8 The Default Window File menu Close icon Current directory Command window Workspace window Command history

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-9 Array Editor New variable icon

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Scripts Create a script derived from the Pythagorean theorem to compute the hypotenuse of a right triangle: H 2 = A 2 + B 2 where A and B are the sides adjacent to the right angle, and H is the hypotenuse opposite. clear clc A = 3; % the first side of a triangle B = 4; % the second side of a triangle hypSq = A^2 + B^2; % the square of the % hypotenuse H = sqrt(hypSq) % the answer

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Engineering Example—Spacecraft Launch clear clc cmPerInch = 2.54; % general knowledge inchesPerFt = 12; % general knowledge metersPerCm = 1/100; % general knowledge MetersPerFt = metersPerCm * cmPerInch * inchesPerFt; startFt = 25000; % ft - given startM = startFt * MetersPerFt; g = 9.81; % m/sec^2 top = 100; % km - given s = (top*1000) - startM; % m initial_v = (2*g*s)^0.5 % the final answer

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-12 Spaceship 1

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-13 Summary – MATLAB User Iterface ■ The Command window lets you experiment with ideas by entering commands line-by-line and seeing immediate results. ■ The Command History window lets you review and recall previous commands. ■ The Workspace window lists the names, values, and class of your local variables. ■ The Current Directory window lists the current files in the directory to which MATLAB is currently pointed. ■ A Document window opens when a variable in the Workspace window is selected, to let you view and edit data items. ■ The Graphics window presents data and/or images when invoked by programs. ■ The Editor window lets you view and modify text files. ■ Scripts provide the basic mechanism for implementing solutions to problems.

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-14 Questions?

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-15