1 / 11

MATLAB Basics: Matrix Manipulations, Programming, Graphics, Image Types, and Processing

An introduction to MATLAB, covering matrix manipulations, MATLAB programming, graphics, image types, and image processing. Includes useful functions and examples.

mmarcella
Télécharger la présentation

MATLAB Basics: Matrix Manipulations, Programming, Graphics, Image Types, and Processing

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. Introduction MATLAB stands for MATrix LABoratory. Basics Matrix Manipulations MATLAB Programming Graphics Image types Image Processing Useful functions

  2. Basics • Basic data element is an array that does not require dimensioning. • A=[1 2 3;4 5 6; 7 8 9] A = [ 1 2 3 4 5 6 7 8 9]

  3. Matrix Manipulations • Sum(A) = sums of the columns of A • A’ = Transpose of A • Diag(A) = gives diagonal elements of A • Min(A) = minimum element column wise of A. • Max(A) = maximum element column wise of A. • Mean(A) = Average element column wise of A. • Std(A) = Standard deviation column wise of A. • X = zeros(5,5) Y = ones(6,6) • M=rand(5,5) N = randn(6,6) • A=[1:50] • A=[0:pi/4:pi]=[0 0.7854 1.5708 2.3562 3.1416]

  4. Matrix Manipulations (contd..) • B = magic(4) = [ 16 2 3 13 Dürer's magic square 5 11 10 8 9 7 6 12 4 14 15 1] • All numbers are stored internally using the long format specified by the IEEE floating-point standard. • Floating-point numbers have • finite precision16 significant decimal digits and • finite range 10-308 to 10+308.

  5. Matrix Manipulations (contd..) • A(:,2) = []  deletes 2nd column. • A(2:2:12) = [] results in row vector of remaining elements. • A = A.*5  Element-by-element multiplication. • [indices] = find(isprime(A)) • format  this command can be used for formatting the displayed numeric output (either in short or long format).

  6. MATLAB Programming MATLAB has several flow control constructs: • if statements • switch statements • for loops • while loops • continue statements • break statements

  7. Graphics • Plotting sinusoidal function using the plot function. • Cylinder  unit cylinder with default 20 points on the circumference. • Sphere  unit sphere with default 20 points on the circumference. • Subplot(m,n,p)  partitions the figure window into m-by-n matrix of small subplots and selects the pth subplot for the current plot.

  8. Graphics (contd..) • mesh produces wire frame surfaces that color only the lines connecting the defining points. • surf displays both the connecting lines and the faces of the surface in color. • Light and camera effect on the visualization of 2-dim sinc function (i.e. sin(r)/r) between x and y directions.

  9. Types of Images • Index images • Intensity images • Binary images • RGB images

  10. Image Processing • Dürer's magic square • Animation using EraseMode property. • Animation using Movie method • Functions: • Imread  read an image • Imwrite  writes specified matrix into an image. • Image  displays specified matrix as an image. • Imshow  Displays an intensity (gray level) image. • Im2frame  converts an image into movie frame. • Avifile  creates an avifile object. • Addframe  adds movie frame to avifile object. • Getframe  returns movie frame. • Movie  Play recorded movie frames. • close  closes current figure.

  11. Useful functions • help fnName  help on any function. • whos  information on current variables in the workspace. • guide  GUI editor. • demo  Matlab toolboxes and functions demo. • eval(str)  evaluates expression in the str variable. • load abc.mat  loads data in the matlab file.

More Related