ECSE4963 Introduction to Subsurface Sensing and Imaging Systems - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

ECSE4963 Introduction to Subsurface Sensing and Imaging Systems

Description:

Create column vectors with semi-colons. Can force to column vector with ... From using commas/spaces and semi-colons. A=[1 2 3; 4 5 6; 7 8 9]; A(j,k)= j'th row, ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 31
Provided by: badrinat
Category:

less

Transcript and Presenter's Notes

Title: ECSE4963 Introduction to Subsurface Sensing and Imaging Systems


1
ECSE-4963Introduction to Subsurface Sensing and
Imaging Systems
  • Lecture 2 Introduction to MATLAB
  • Kai Thomenius1 Badri Roysam2
  • 1Chief Technologist, Imaging technologies,
  • General Electric Global Research Center
  • 2Professor, Rensselaer Polytechnic Institute

Center for Sub-Surface Imaging Sensing
2
Review of Last Lecture
  • Subsurface imaging Course Focus
  • Many applications to Biology, Medicine, Industry,
    Homeland Security
  • Probes, media, and probe-media interactions
  • Methods by which we examine contents of hidden
    volumes
  • Wave theory the common thread
  • Common to electromagnetic and acoustic probing
  • This Class
  • Overview of Matlab tools

3
Outline of Course Topics
  • THE BIG PICTURE
  • What is subsurface sensing imaging?
  • Why a course on this topic?
  • EXAMPLE THROUGH TRANSMISSION SENSING
  • X-Ray Imaging
  • Computer Tomography
  • COMMON FUNDAMENTALS
  • propagation of waves
  • interaction of waves with targets of interest 
  • PULSE ECHO METHODS
  • Examples
  • MRI
  • A different sensing modality from the others
  • Basics of MRI
  • MOLECULAR IMAGING
  • What is it?
  • PET Radionuclide Imaging
  • IMAGE PROCESSING CAD

4
Sources
  • These slides have been collected from a number of
    sources
  • www.cs.cornell.edu/Courses/cs401/2001fa
  • www.soes.soton.ac.uk/MSc/current/matlab.ppt
  • Matlab File Exchange
  • www.mathworks.com/matlabcentral/fileexchange/loadC
    ategory.do
  • While there, download the following MATLAB
    Programming Style Guidelines by Richard Johnson

5
Matlab History
  • Matlab stands for Matrix Laboratory
  • Created by Dr. Cleve Moler in the 1970s, then a
    professor at U. of New Mexico
  • Now Dr. Moler is Chief Scientist Mathworks, Inc.
  • Mathworks is now a major computer company
  • Developed from LAPACK--a series of routines for
    numerical linear algebra
  • Consequences
  • is funny, / is even funnier
  • Matlab does linear algebra really well

6
Starting Up
  • On Windows
  • Launch from START, or find matlab.exe double
    click
  • On UNIX/Linux
  • Open a terminal, type matlab
  • Problems
  • Command not found--check your path
  • Splash window of 6.X hangs--try matlab -nojvm

7
Matlab Windows
  • As of 6.0, Matlab has lots of windows inside a
    Desktop
  • The Workspace is the center of the Matlab
    universe
  • Holds your data
  • Waits for your commands
  • (other windows are fluff)
  • 5.X only has workspace

8
Basic Math
  • Matlab is a command-line calculator
  • Simple arithmetic operators
  • - /
  • Basic functions
  • sin(), log(), log10(), exp(), rem()
  • Constants
  • pi, e

9
Big deal, a calculators 20
  • Matlab is a fully-functional programming language
  • This means we get variables
  • name value
  • Name can be anything made of letters, numbers,
    and a few symbols (_). Must start with a letter
  • End line with to avoid output
  • Can also use to put multiple commands on a
    line
  • List with who
  • Delete with clear
  • More info with whos

10
1D Arraysa.k.a. Vectors
  • An array is anything you access with a subscript
  • 1D arrays are also known as vectors
  • Everything (nearly) in Matlab is a double array
  • Create arrays with brackets
  • Separate elements with commas or spaces
  • Access with ()s

11
Regular arrays
  • We can create regularly spaced arrays using
  • Asten produces st, st1, st2, en
  • A15 is 1 2 3 4 5
  • A-3.52 is -3.5 -2.5 -1.5 0.5 1.5---note,
    stops before 2!
  • What happens if en lt st ?
  • Can also insert a step size Aststepen
  • A026 is 0 2 4 6
  • A5-2.50 is 5 -2.5 0

12
Accessing vectors
  • Matlab arrays start at 1
  • In most languages (C, Java, F77) can only access
    arrays one element at a time
  • a(1)1 a(2)2.5 a(3)-3 etc.
  • In Matlab, can access several elements at a time
    using an array of integers (aka an index)
  • a(15) is a(1),a(2),a(3),a(4),a(5)
  • a(5-21) is a(5), a(3), a(1)

13
Accessing vectors
  • Index vectors can be variables
  • A1010100 I129 A(I) gives
    10,30,50,70,90
  • J2210A(J) gives 20,40,60,80,100
  • What does A(I)A(J) do?

14
Column vectors
  • row vectors are 1-by-n
  • column vectors are n-by-1
  • Row/column distinction doesnt exist in most
    languages, but VERY IMPORTANT in MATLAB
  • Create column vectors with semi-colons
  • Can force to column vector with ()
  • Convert column-to-row and back with transpose ()
  • Can access the same way as row vectors

15
2D arrays--matrices
  • From using commas/spaces and semi-colons
  • A1 2 3 4 5 6 7 8 9
  • A(j,k) jth row, kth column
  • A(23,12) rows 2 through 3 and columns 1
    through 2
  • A(1,3,4, ) all of rows 1, 3 and 4
  • A(, 1) first column

16
Size matters
  • A is m-by-n means A has m rows and n columns
  • m,nsize(A) gets size of A
  • length(a) gets length of vectors.
  • A(13,2)v, v better have length 3
  • A(125,23)B, B better be 3-by-2

17
Array Arithmetic
  • CAB
  • if A and B are the same size, C(j,k)A(j,k)B(j,k)
  • If A is a scalar, C(j,k)AB(j,k)
  • Same for -

18
Array Multiplication
  • Multiplication is weird in Matlab
  • Inherited from linear algebra
  • To multiply by a scalar, use
  • To get C(j,k)A(j,k)B(j,k) use .
  • Also applies to . and ./

19
Matrix Multiplication CAB
  • A is m-by-p and B is p-by-n then C is m-by-n
  • C(i,j) a(i,1)b(1,j)a(i,2)b(2,j)
    a(i,p)b(p,j)
  • Another view
  • C(i,j)a(i,)b(,j)
  • 1-by-p p-by-1 answer is 1-by-1

20
ND arrays
  • Until V5, Matlab arrays could only be 2D
  • Now has unlimited dimensions
  • Aones(2,3,2)
  • A is a 3D array of ones, with 2 rows, 3 columns,
    and 2 layers
  • A(,,1) is a 2-by-3 matrix
  • squeeze command is very important

21
What kind of graphics is possible in Matlab?
Polar plot t0.012pi
polar(t,abs(sin(2t).cos(2t)))
Line plot x00.055,ysin(x.2),plot(x,y)
Stem plot x 00.14, y
sin(x.2).exp(-x) stem(x,y)
22
What kind of graphics is possible in Matlab?
Surface plot zpeaks(25), surf(z),
colormap(jet)
Mesh plot zpeaks(25), mesh(z)
Contour plot
zpeaks(25),contour(z,16)
Quiver plot
28 January 2003, Matlab tutorial Joanna Waniek
(jowa_at_soc.soton.ac.uk)
23
Iteration
  • For loops in Matlab use index-notation
  • for jststepen
  • ltcommands involving jgt
  • end
  • Example uv
  • tot0
  • for j1length(u)
  • tottotu(j)v(j)
  • end

24
Conditionals
  • Conditional statements control flow of a program
  • if(logic)
  • ltcommands executed if truegt
  • else
  • ltcommands executed if falsegt
  • end
  • Matlab also has switch
  • switch(j)
  • case a ltcommands if ajgt
  • case b ltcommands if bjgt
  • otherwise ltdefault commandsgt
  • end

25
Logic--searching with find
  • Find--searches for the truth (or not false)
  • b1 0 -1 0 0
  • Ifind(b)
  • I1 3 --b(I) is an array without zeros
  • Ifind(ones(3,1) 1 2 32)
  • I 4 5 6
  • I,Jfind(ones(3,1) 1 2 32)
  • I 1 2 3
  • J 2 2 2

26
Programming
  • Matlab programs are stored in m-files
  • Text files containing Matlab commands and ending
    with .m
  • Script m-files--commands executed as if entered
    on command line
  • Function m-files--analogous to subroutines or
    methods, maintain their own memory (workspace)

27
Functions
  • First line of file must be function
    outputsfname(inputs)
  • outputs and inputs can be blank
  • Comments immediately following are returned by
    help
  • Functions must be in current directory or in
    Matlabs search path

28
Summary
  • Matlab
  • Very widely used mathematical modeling tool
  • Brief introduction to MATLABs key concepts
  • Arrays, vectors, matrices, their addressing
  • Graphics w. MATLAB
  • Iteration program flow
  • Conditionals
  • Next Class
  • Projection Imaging X-rays

29
Instructor Contact Information
  • Badri Roysam
  • Professor of Electrical, Computer, Systems
    Engineering
  • Office JEC 7010
  • Rensselaer Polytechnic Institute
  • 110, 8th Street, Troy, New York 12180
  • Phone (518) 276-8067
  • Fax (518) 276-6261/2433
  • Email roysam_at_ecse.rpi.edu
  • Website http//www.rpi.edu/roysab
  • NetMeeting ID (for off-campus students)
    128.113.61.80
  • Secretary Betty Lawson, JEC 7012, (518) 276
    8525, lawsob_at_.rpi.edu

30
Instructor Contact Information
  • Kai E Thomenius
  • Chief Technologist, Ultrasound Biomedical
  • Office KW-C300A
  • GE Global Research
  • Imaging Technologies
  • Niskayuna, New York 12309
  • Phone (518) 387-7233
  • Fax (518) 387-6170
  • Email thomeniu_at_crd.ge.com, thomenius_at_ecse.rpi.edu
  • Secretary TBD
Write a Comment
User Comments (0)
About PowerShow.com