ES 314 Lecture 2 Sep 1 Summary of lecture 1: course overview intro to matlab sections of Chapters 2 and 3.

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction.
Advertisements

CSE202: Lecture 2The Ohio State University1 Variables and C++ Data Types.
1 CSE1301 Computer Programming Lecture 6 C Primitives 3.
1 9/10/07CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
ES 314 Advanced programming, simulation and modeling lecture: M W 9 to 10 : 50 AM 2008, Salazar Hall.
CMT Programming Software Applications
1 9/8/08CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
Aalborg Media Lab 21-Jun-15 Software Design Lecture 2 “ Data and Expressions”
Data types and variables
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.
CS150 Introduction to Computer Science 1
Chapter 2 Data Types, Declarations, and Displays
Guide To UNIX Using Linux Third Edition
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Fourth Edition.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
1 Lecture 3  Lexical elements  Some operators:  /, %, =, +=, ++, --  precedence and associativity  #define  Readings: Chapter 2 Section 1 to 10.
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.
Basic Elements of C++ Chapter 2.
1 CSE1301 Computer Programming Lecture 6: Components of a C Program (Part 2)
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Objectives You should be able to describe: Data Types
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Copyright © 2002 W. A. Tucker1 Chapter 7 Lecture Notes Bill Tucker Austin Community College COSC 1315.
C Tokens Identifiers Keywords Constants Operators Special symbols.
COMP 116: Introduction to Scientific Programming Lecture 28: Data types.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
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 ,
Input, Output, and Processing
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Lecture #5 Introduction to C++
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
The Fundamentals of C++ Chapter 2: Basic programming elements and concepts JPC and JWD © 2002 McGraw-Hill, Inc. Modified by S. Sudarshan.
CSE1222: Lecture 2The Ohio State University1. mathExample2.cpp // math example #include using namespace std; int main() { cout
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Digital Image Processing Lecture4: Fundamentals. Digital Image Representation An image can be defined as a two- dimensional function, f(x,y), where x.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Agenda ASCII char N int Character class char N String Bitwise operators homework.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Es 314 Programming, simulation and modeling lecture: M W 9 – 10: , Salazar Hall.
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.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
1 09/03/04CS150 Introduction to Computer Science 1 What Data Do We Have.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
MATLAB Constants, Variables & Expression Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Chapter 1.2 Introduction to C++ Programming
Basics (Variables, Assignments, I/O)
Chapter 1.2 Introduction to C++ Programming
Revision Lecture
Introduction to the C Language
Basics (Variables, Assignments, I/O)
An overview of Java, Data types and variables
Presentation transcript:

ES 314 Lecture 2 Sep 1 Summary of lecture 1: course overview intro to matlab sections of Chapters 2 and 3

Lecture 2 goals: Chapter 3 (variables, numbers and strings) Chapter 4 (arrays, vectors and structures)

Skipped slides: 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

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 – 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

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

Matlab – Introduction (Ch 2) Exercise 2.1: Evaluate the expression 3 – 5 + 4/6 – 8 *4^2 Ans: 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. Ans: rdivide(minus(3, plus(5,times(2,8))),4)

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 (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’