Download presentation

Presentation is loading. Please wait.

Published byGordon Dorsey Modified over 2 years ago

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

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

3
Skipped slides: signal generation and display – simple example

5
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

6
Image processing original image restored image

7
Image merging input output

8
Image merging – a more complex example Input images output Example taken from http://www.graficaobscura.com/merge/index.htmlhttp://www.graficaobscura.com/merge/index.html

9
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.

10
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.

11
contour slices Example taken from: http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/te chdoc/matlab.html http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/te chdoc/matlab.html

12
Matlab – working windows

13
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.)

14
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

15
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

16
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

17
Matlab – Introduction (Ch 2) Exercise 2.1: Evaluate the expression 3 – 5 + 4/6 – 8 *4^2 Ans: -129.3333 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)

18
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.

19
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 = 325.499; >> int16(x) ans = 325 >> x = x +.001; >> int16(x) ans = 326 Built-in functions that convert to int Other related functions: floor, ceil

20
long floating-point format >> format long >> x = 1.5^2.3; >> x x = 2.54103060477792 >> format short >> x x = 2.5410 >> x = 2.564593653; >> x x = 2.5646 >>

21
Complex numbers

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

Similar presentations

OK

Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers Vectors: 1-D Arrays Arrays: 2-D Arrays Array Addressing Strings & String.

Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers Vectors: 1-D Arrays Arrays: 2-D Arrays Array Addressing Strings & String.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on tcp/ip protocol suite protocols Ppt on business environment nature concept and significance of study Ppt on personality development notes Seminar ppt on cloud computing Tissue anatomy and physiology ppt on cells Ppt on review writing service Ppt on grammar translation method Ppt on railway track Ppt on hydroelectric dams in india Ppt on electricity for class 10th result