+ All Categories
Home > Documents > General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information...

General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information...

Date post: 19-Dec-2015
Category:
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
13
General Computer Science General Computer Science for Engineers for Engineers CISC 106 CISC 106 Lecture 22 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009
Transcript
Page 1: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

General Computer General Computer Science Science

for Engineersfor EngineersCISC 106CISC 106

Lecture 22Lecture 22

Dr. John CavazosComputer and Information Sciences

04/13/2009

Page 2: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Lecture OverviewLecture OverviewSymbolic Debugger (137-140)Date Types

Memory size/efficiency/accuracy

Page 3: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Symbolic DebuggerSymbolic DebuggerOpen m-file to debug in Matlab

editorCan set breakpoints

Where you want execution to suspend

Execute in command window as normal

, 2009 from 1:00 PM to 1:30 PM

Page 4: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Symbolic DebuggerSymbolic DebuggerExecution suspends in editor at

breakpointCan view variables in command

windowCan step through the codeCan continue to next

breakpoint17, 2009 from 1:00 PM to 1:30 PM

Page 5: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Classes of Data TypesClasses of Data Types

Page 6: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Single-Precision floating Single-Precision floating pointpointStores number in 32 bitsBit 31 is sign (0 = positive, 1 =

negative)Bits 0 through 30 for number

(exponent and fraction), 2009 from 1:00 PM to 1:30 PM

Page 7: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Double-Precision (default)Double-Precision (default)Stores number in 64 bits

Bit 63 is sign (0 = positive, 1 = negative)

Bits 0 through 62 for number (exponent and fraction), 2009

from 1:00 PM to 1:30 PM

Page 8: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Integers (Signed Values)Integers (Signed Values)int8 (8 bits) can represent -128 to

127int16, int32, int64

x = int8(200) x ←127

x=int8(-500)x ← -128;

Page 9: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Integers (Unsigned Integers (Unsigned Values)Values)uint8 (8 bits) can represent 0 to

255uint16, uint32, uint64

x = uint8(400) x ←255

x=uint8(-500)x ← 0;

Page 10: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

iintmin and intmaxntmin and intmax

intmin(‘uint8’) 0intmax(‘int8’) 127

Page 11: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Integer arraysInteger arrays

array = zeros(100,100, ‘int8’);

Creates a 100-by-100 int8 array initialized to zero.

Page 12: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

EfficiencyEfficiency

• If array will only require certain values• Use correct datatype!

• For example:• Images typically only have 0-

255 values• Need only uint8

Page 13: General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.

Efficiency (cont’d)Efficiency (cont’d)

• double requires 8 bytes• uint8 requires 1 byte• Double requires 8 times more

memory to store images!


Recommended