ES 314 Advanced programming, simulation and modeling lecture: M W 9 to 10 : 50 AM 2008, Salazar Hall.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Computer Programming w/ Eng. Applications
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
ES 314 Lecture 2 Sep 1 Summary of lecture 1: course overview intro to matlab sections of Chapters 2 and 3.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
1 9/10/07CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
Lecture 3 August 31 Chapter 3. Chapter 3 – numbers, string, booleans integer: MATLAB stores numeric data as double-precision floating point (double) by.
Es 314 Programming, simulation and modeling lecture: M W 3 – 4:50 PM 2008, Salazar Hall.
Topic R3 – Review for the Final Exam. CISC 105 – Review for the Final Exam Exam Date & Time and Exam Format The final exam is 120-minutes, closed- book,
Chapter 2 Data Types, Declarations, and Displays
Guide To UNIX Using Linux Third Edition
COMP1170 Midterm Preparation (March 17 th 2009) Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Digital Image Processing Lecture3: Introduction to MATLAB.
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
Imperative Programming
Topics Introduction Hardware and Software How Computers Store Data
1 Lab Session-III CSIT-120 Fall 2000 Revising Previous session Data input and output While loop Exercise Limits and Bounds Session III-B (starts on slide.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Data, graphics, and programming in R 28.1, 30.1, Daily:10:00-12:45 & 13:45-16:30 EXCEPT WED 4 th 9:00-11:45 & 12:45-15:30 Teacher: Anna Kuparinen.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Eng Ship Structures 1 Introduction to Matlab.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Chapter 2: First Steps in MuPAD MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
Introduction to Programming with RAPTOR
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Es 314 Programming, simulation and modeling lecture: M W 9 – 10: , Salazar Hall.
Engineering Analysis – Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
CIS 601 Fall 2003 Introduction to MATLAB Longin Jan Latecki Based on the lectures of Rolf Lakaemper and David Young.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
1-2 What is the Matlab environment? How can you create vectors ? What does the colon : operator do? How does the use of the built-in linspace function.
Lecture: MATLAB Chapter 1 Introduction
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
PHP.
Digital Image Processing
INTRODUCTION TO MATLAB
Experiment No. (1) - an introduction to MATLAB
Simulation And Modeling
Introduction To MATLAB
Presentation transcript:

ES 314 Advanced programming, simulation and modeling lecture: M W 9 to 10 : 50 AM 2008, Salazar Hall

Catalog Description of the course: Lecture: 4 hours; laboratory: 0 hours. Pointers and dynamic allocation of storage; linked lists; an introduction to the object oriented programming (OOP) paradigm; classes and objects; encapsulation; member variables and member functions. Static arrays, dynamic arrays, stacks and queues, linked lists, hashing. System modeling techniques and applications such as generation of noise (random numbers) and correlated signal with different pdfs, measurement of statistical parameters like moments, queuing systems and system simulation. Prerequisite: CS 115: Programming I. Co-requisites: MATH 345: Probability Theory and ES 220: Electric Circuits, or consent of instructor.

Goals of the course: To introduce software design for engineering applications through MATLAB programming, computational modeling of physical systems and software simulation of simple physical systems. Specifically, the following topics will be covered: MATLAB programming – iteration, library and user-defined functions, scripts, structured data and objects, image and audio files, plotting and visualization, recursion, project design and development. performing statistical analyses of data (e.g. parameter estimation) fundamental algorithms for sorting, searching, solving system of equations etc. computational modeling simulation of physical systems and models: network and queuing models

Text book Kaplan, Daniel T. Introduction to Scientific Computation and Programming, Brooks/Cole-Thomson Learning, ScientificProgramming/index.html We will cover most of Chapters 1 to 12. For simulation and modeling, we will use other sources.

Course History current offering is the second. previous offering – Fall 2008 co-taught by Dr. Jagan Agrawal, Dr. Ali kujoory and myself used c++ for programming, no specific language was required by Dr. Agrawal, Dr. Kujoory used MATLAB.

Grading short quizzes: ~10 points The quizzes will be in-class for a duration to 10 to 15 minutes, one for each class. programming assignments and projects: ~40 points Most of the assignments will involve problem solving and implementing the solution using MATLAB. There may be a final project chosen by each student individually. mid-semester tests (2): ~25 points, in-class. final examination: ~25 points This exam will be in-class and comprehensive. It will take place at the time scheduled by registrar’s office. You can find out from the web page: university/classsched/finals_sched.pdfhttp:// university/classsched/finals_sched.pdf

course overview Matlab programming simulation and modeling case studies database, graphics and plotting, audio, image processing, modeling of bio-signals etc. probabilistic models of network traffic, queuing models etc.

Matlab programming language most widely used by engineers other similar ones: mathematica, maple, mathcad, macsyma vector and matrix centered. (Name comes from MATrix LABoratory). extensive support for mathematical operations, plotting, visual presentation of results toolboxes for areas such as signal processing, image processing, wavelets, bioinformatics

Matlab programming language Why it is useful engineering applications: large toolbox of numeric/image library functions very useful for displaying, visualizing data high-level: focus on algorithm structure, not on low level details allows quick prototype development of algorithms

User interface interactive mode result appears immediately after the command is entered interpreted language scripts for sequence of operations, programs save scripts as files with.m extension

Main features of Matlab simple data types: numbers, string, boolean structured types: vector, matrix, indexing, mixed data types (structures and objects) files and scripts

Main features of Matlab functions: user defined functions more advanced features: recursion, function as parameter, function as return value etc. conditionals: if statement, if … then.. else, switch statement loops: for loop, nested loops, loop termination, conditional loop

Main features of Matlab scope: environment and scope resolving name conflicts events: reactive program user interface design

tutorials has links to tutorials, video clips on various topicshttp:// other tutorials and many others.

Stochastic models – example What is the probability that a web page is visited? Model: each web page is represented by a node and each link from page A to page B is an edge in the graph. Assume a visitor to a page will randomly click on one of the links on the page. Also assume that one starts with probability 1/n at any page (where n = total number of pages). This model is called a Markov chain.

Markov chain – simulation Shown below is a simple Markov chain. What is the average number of steps it takes to move from state 1 to state 3? 132 Assume all outgoing arcs have the same probability Application: assuming that the server has probability = 0.55 of winning a game, what is the average length of a game in tennis?

signal generation and display – simple example

Image models 2-d image of a photograph: Digital image is represented by a collection of pixels. Each pixel has a color value represented by 32 bits. (R, G, B, A) values. Digital images can be processed in various ways: compression restoration, de-blurring enhancement, noise reduction

Image processing original image restored image

Image merging input output

Image merging – a more complex example Input images output Example taken from

Volume Data Representation and Visualization Typical scalar volume data is composed of a 3-D array of data and three coordinate arrays of the same dimensions. The coordinate arrays specify the x-, y-, and z-coordinates for each data point. For example, flow data might have coordinate units of inches and data units of psi. A number of MATLAB functions are useful for visualizing scalar data: Slice planes provide a way to explore the distribution of data values within the volume by mapping values to colors. You can orient slice planes at arbitrary angles, as well as use nonplanar slices. You can specify the data used to color isosurfaces, enabling you to display different information in color and surface shape Contour slices are contour plots drawn at specific coordinates within the volume. Contour plots enable you to see where in a given plane the data values are equal.

MRI Data Visualization MRI data typically contains a number of slice planes taken through a volume, such as the human body. MRI data formats that can be accessed directly through Matlab: A series of 2-D images representing slices through the head 2-D and 3-D contour slices taken at arbitrary locations within the data An isosurface with isocaps showing a cross section of the interior.

contour slices Example taken from: chdoc/matlab.html& chdoc/matlab.html&

Matlab – working windows

Matlab – Introduction (Ch 2) Variables:

Variable definition need not be declared Variable names can contain up to 63 characters Variable names must start with a letter followed by letters, digits, and underscores. Variable names are case sensitive. Key words can’t be used as variable names. (Key words list is in the next slide.)

Matlab Special Variables ans Default variable name for results pi: Value of π >> pi ans = eps: smallest incremental number inf: Infinity NaN: Not a number e.g. 0/0 realmin: The smallest usable positive real number realmax: The largest usable positive real number

Matlab – Introduction (Ch 2) key words: if, else, end, for, while, break, switch, case, try, catch, return, global, function, persistent etc. arithmetic operations: + – * (or.*) latter used for component-wise * in vector / (or./) \ (or.\) ^ (or.^) a^b stands for a b

Other MATLAB symbols >> prompt... continue statement on next line,separate statements and data %start comment which ends at end of line ;(1)suppress output (2)used as a row separator in a matrix :specify range

Matlab – Introduction (Ch 2) Exercise 2.1: Evaluate the expression 3 – 5 + 4/6 – 8 *4^2 Exercise 2.2: Write (3 – (5 + 2* 8))/4 in functional style using plus, minus, times and rdivide. a + b is written as plus (a, b) in functional style.

some helpful commands >> whos Lists all the variables currently active in environment >> lookfor gives all sentences containing in the manual. Use up arrow to repeat the previous command. >> help

Chapter 3 – numbers, string, booleans integer: MATLAB stores numeric data as double-precision floating point (double) by default. To store data as an integer, you need to convert from double to the desired integer type. Example: To store 325 as a 16-bit signed integer assigned to variable x: >> x = int16(325); If the number being converted to an integer has a fractional part, MATLAB rounds to the nearest integer.

If the fractional part is exactly 0.5, then from the two equally nearby integers, MATLAB chooses the one for which the absolute value is larger in magnitude: >> x = ; >> int16(x) ans = 325 >> x = x +.001; >> int16(x) ans = 326 Built-in functions that convert to int Other related functions: floor, ceil

long floating-point format >> format long >> x = 1.5^2.3; >> x x = >> format short >> x x = >> x = ; >> x x = >>

Complex numbers

Strings Character: alphabetical – upper/lower (‘a’.. ‘z’, ‘A’.. ‘Z’) digits – 0, 1, …, 9 special characters - $, % etc. control characters - \n (end of line) etc. Each character is encoded by 8 bits (ASCII) or 16 bits (unicode) Unicode allows encoding of alphabets from many languages such as Hungarian, Chinese, Swahili etc. String - sequence of characters. >> greeting = ‘hello’

String operations >> length(word) ans = 5 >> strcmp(word, ‘hello!’) ans = 1 if the Boolean expression is true, 0 else. Strcmp compares two strings.