Matlab tutorial and Linear Algebra Review

Matlab tutorial and Linear Algebra Review

Announcements Class mailing list: send email to Hyoungjune Yi: [email protected] Homework at the end of class. Text is on reserve in the CS library. Powerpoint should be available by 10am class day. Matlab tutorial and Linear Algebra Review

Todays goals: Learn enough matlab to get started. Review some basics of Linear Algebra Essential for geometry of points and lines. But also, all math is linear algebra. (ok slight exaggeration). Many slides today adapted from Octavia Camps, Penn State. Starting Matlab For PCs, Matlab should be a program. For Suns: Numerical

Analysis and Visualization Matlab 6.1 Help help help command Eg., help plus Help on toolbar demo Tutorial: http://amath.colorado.edu/scico/tutorials /matlab/ Matlab interpreter Many common functions: see help ops

Vectors v ( x1 , x2 , , xn ) Ordered set of numbers: (1,2,3,4) v Example: (x,y,z) coordinates of pt in If space. n

2 i 1 i x v 1, v is a unit vector Indexing into vectors Vector Addition v w ( x1 , x2 ) ( y1 , y2 ) ( x1 y1 , x2 y2 ) v

V+w w Scalar Product av a ( x1 , x2 ) (ax1 , ax2 ) av v Operations on vectors sum max, min, mean, sort, Pointwise: .^ Inner (dot) Product v

w v.w ( x1 , x2 ).( y1 , y2 ) x1 y1 x2 . y2 The inner product is a SCALAR! v.w ( x1 , x2 ).( y1 , y2 ) || v || || w || cos v.w 0 v w Matrices Anm a11 a

21 a31 an1 a12 a22 a32 an 2 a1m a2 m a3m

anm Sum: Cnm Anm Bnm cij aij bij A and B must have the same dimensions Matrices Product: Cnp Anm Bmp

m cij aik bkj k 1 Identity Matrix: A and B must have compatible dimensions Ann Bnn Bnn Ann 1 0 0 0 1 0

I 0 0 1 IA AI A Matrices Transpose: T Cmn A

nm cij a ji If T A A T T ( A B) A B ( AB )T B T AT A is symmetric

T Matrices Determinant: A must be square a11 det a21 a12 a11 a22 a21

a11 det a21 a31 a12 a22 a32 a12 a11a22 a21a12 a22 a13 a22

a23 a11 a32 a33 a23 a21 a12 a33 a31 a23 a21 a13 a33 a31

a22 a32 Matrices Inverse: Ann A a11 a 21 A must be square 1 nn

a12 a22 A 1 1 nn Ann I 1 a11a22 a21a12

a22 a 21 a12 a11 Indexing into matrices Euclidean transformations 2D Translation P t P

2D Translation Equation ty P P t P ( x, y ) t (t x , t y ) y x tx

P ' ( x t x , y t y ) Pt 2D Translation using Matrices ty P P t y x tx

P ( x, y ) t (t x , t y ) t x x tx 1 0 tx P' y y ty 0 1 ty 1 P

Scaling P P Scaling Equation P s.y P P ( x, y ) P ' ( sx, sy ) P' s P

y x s.x sx s 0 x P ' sy 0 s y P ' S P S Rotation

P P Rotation Equations Counter-clockwise rotation by an angle Y P y X

P x x' cos y ' sin P' R.P sin x cos y Degrees of Freedom x' cos y ' sin

sin x cos y R is 2x2 4 elements BUT! There is only 1 degree of freedom: The 4 elements must satisfy the following constraints: R R T R T R I det(R ) 1

Stretching Equation P ( x, y ) P' ( s x x, s y y ) P Sy.y sx x sx P ' s y 0 y P

y x 0 x sy y S Sx.x P ' S P Stretching = tilting and projecting (with weak perspective) sx x sx

P ' s y 0 y 0 x sy y sx s y s y 0

0 x y 1 Linear Transformation a b x P' c d y sin cos

sin s y cos SVD cos s x 0 sin 0 sin cos x

s y cos sin y sx cos 0 sin cos x sy cos sin y sin 0 1 Affine Transformation x a b tx

P' y c d ty 1 Files Functions Format: function o = test(x,y) Name function and file the same. Only first function in file is visible outside the file. Images

Debugging Add print statements to function by leaving off ; keyboard debug and breakpoint Conclusions Quick tour of matlab, you should teach yourself the rest. Well give hints in problem sets. Linear algebra allows geometric manipulation of points. Learn to love SVD.

Recently Viewed Presentations

  • Service Learning Project - hisdjrotcoperations.com

    Service Learning Project - hisdjrotcoperations.com

    use a decision-making model. recognize the need to make informed decisions. take personal responsibility for decisions. Setting Personal Goals: Reinforce that in the way they made decisions today will help them think about their choices and make better decisions in...
  • Freud's Stages of Psychosexual Development

    Freud's Stages of Psychosexual Development

    Freud's Stages of Psychosexual Development Biography Notable Facts: -He was born May 6th, 1856. -He was born in Freiberg in Moravia. -He discovered that he had cancer of the mouth in 1923. -He was Jewish. -During the war he escaped...
  • Subjective Objects - Visual Art classes

    Subjective Objects - Visual Art classes

    sub·jec·tive. səbˈjektiv/ adjective. 1. based on or influenced by personal feelings, tastes, or opinions. "his views are highly subjective" 2.
  • Welcome to Myton Park Primary School

    Welcome to Myton Park Primary School

    Playtimes at Myton Park Primary School Playtimes Playtime is an important part of the day for many children and is often a very welcome break from the structure and routine of the classroom.
  • Shabbat Shalom Saints Welcome to The Miqra Proclaiming

    Shabbat Shalom Saints Welcome to The Miqra Proclaiming

    2Timothy 3:13-15 (New American Standard). But . evil men and impostors will proceed [from bad] to worse, deceiving and being . deceived. You, however, continue in the things you have learned and become convinced of, knowing from whom you have...
  • A-Z An Historical Survey of Women Artists

    A-Z An Historical Survey of Women Artists

    Photographer of over 3,000 images of people, crafts and landscapes the Appalachian Mountains, using archaic large-format cameras. I was prompted to work slowly, outdoors in limited color. "Jason Reed" 1933, a chair maker from North Carolina, working wood on the...
  • The Development of Child Protection Law and its

    The Development of Child Protection Law and its

    Paul Davis Legal The Development of Child Protection Law and its Impact Effective Risk Management State of New South Wales v Paige [2002] NSWCA 235 In this appeal of the District Court where it was found that the DET had...
  • عرض تقديمي في PowerPoint

    عرض تقديمي في PowerPoint

    fastest. growing religion in the . world. 21 of the 22 Arab countries are Muslim. 50 out of the 258 countries of the world are Muslim. Glossary. Islam. means "submission" ... old woman by the name . Khadijah, who invested...