Download presentation
Presentation is loading. Please wait.
1
MATLAB stands for MATrix LABoratory.
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 = [ ]
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]=[ ]
4
Matrix Manipulations (contd..)
B = magic(4) = [ Dürer's magic square ] 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 to
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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.