1 / 23

Zen and the Art of MatLab

Zen and the Art of MatLab. Damian Gordon. Hard work done by :. Daphne Gilbert & Susan Lazarus. Introduction to MatLab. MatLab is an interactive, matrix-based system for numeric computation and visualisation MATrix LABoratory

augusta
Download Presentation

Zen and the Art of MatLab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Zen and the Art of MatLab Damian Gordon

  2. Hard work done by : Daphne Gilbert & Susan Lazarus

  3. Introduction to MatLab • MatLab is an interactive, matrix-based system for numeric computation and visualisation • MATrix LABoratory • Used in image processing, image synthesis, engineering simulation, etc.

  4. References • “Mastering MatLab” Duane Hanselman, Bruce Littlefield • “The MatLab Primer” http://www.fi.uib.no/Fysisk/Teori/KURS/WRK/mat/mat.html • “The MatLab FAQ” http://www.isr.umd.edu/~austin/ence202.d/matlab-faq.html

  5. Printed Circuit Board

  6. Specific Bond Selected

  7. Bond Shape Estimated

  8. MATLAB Command Window To get started, type one of these: helpwin, helpdesk, or demo. For product information, type tour or visit www.mathworks.com. » » help HELP topics:

  9. Creating Variables >> varname = 12 varname = 12 >> SS = 56; N = 4; Tot_Num = SS + N Tot_Num = 60

  10. Operations + Addition - Subtraction * Multiplication ^ Power \ Division / Division • Add vars • Subtract vars Multiplication • Raise to the power • Divide vars (A div B) • Divide vars (B div A)

  11. Creating Complex Numbers >> 3 + 2i >> sqrt(9) + sin(0.5)*j ans = 3.0000 + 0.4794i Num = sqrt(9) + sin(0.5)*j real(Num) imag(Num)

  12. Entering Matrices (1) >> A = [1 2 3; 4 5 6; 7 8 9] OR >> A = [ 1 2 3 4 5 6 7 8 9 ]

  13. Entering Matrices (2) • To create an NxM zero-filled matrix >> zeros(N,M) • To create a NxN zero-filled matrix >> zeros(N) • To create an NxM one-filled matrix >> ones(N,M) • To create a NxN one-filled matrix >> ones(N)

  14. Entering Matrices (3) • To create an NxM randomly-filled matrix (which is uniformly distributed) >> rand(N,M) • To create an NxM randomly-filled matrix (which is normally distributed) >> randn(N,M)

  15. Complex Matrices • To enter a complex matrix, you may do it in one of two ways : >> A = [1 2; 3 4] + i*[5 6;7 8] OR >> A = [1+5i 2+6i; 3+7i 4+8i]

  16. MATLAB Command Window » who Your variables are: a b c » whos Name Size Bytes Class a 8x8 512 double array b 9x9 648 double array c 9x9 648 double array Grand total is 226 elements using 1808 bytes

  17. Matrix Addition » A = [ 1 1 1 ; 2 2 2 ; 3 3 3] » B = [3 3 3 ; 4 4 4 ; 5 5 5 ] » A + B ans = 4 4 4 6 6 6 8 8 8

  18. Matrix Subtraction » A = [ 1 1 1 ; 2 2 2 ; 3 3 3] » B = [3 3 3 ; 4 4 4 ; 5 5 5 ] » B - A ans = 2 2 2 2 2 2 2 2 2

  19. Matrix Multiplication » A = [ 1 1 1 ; 2 2 2 ; 3 3 3] » B = [3 3 3 ; 4 4 4 ; 5 5 5 ] » A * B ans = 12 12 12 24 24 24 36 36 36

  20. Matrix - Power » A ^ 2 ans = 6 6 6 12 12 12 18 18 18 » A ^ 3 ans = 36 36 36 72 72 72 108 108 108

  21. Matrix Transpose A = 1 1 1 2 2 2 3 3 3 » A' ans = 1 2 3 1 2 3 1 2 3

  22. Left Division \ x = A\B (is A*x=B) >> A = rand(4) >> B = rand(4) >> C = A \ B => A * C = B Right Division / x=A/B (is x*A=B) >> A = rand(4) >> B = rand(4) >> C = A / B => C * A = B Matrix Division

  23. Matrix Operations + Addition - Subtraction * Multiplication ^ Power ‘ Conjugate Transpose \ Left Division / Right Division • Add matrices • Subtract matrices Matrix Multiplication • Raise to the power • Get transpose • x = A\B (is A*x=B) • x=A/B (is x*A=B)

More Related