MATLAB FOR PATTERN RECOGNITION - PowerPoint PPT Presentation

About This Presentation
Title:

MATLAB FOR PATTERN RECOGNITION

Description:

MATLAB FOR PATTERN RECOGNITION By: zge ztimur How Much Do We Know? Anybody who has never used MATLAB? MATLAB Environment Workspace: Variables defined so far. – PowerPoint PPT presentation

Number of Views:180
Avg rating:3.0/5.0
Slides: 21
Provided by: zge1
Category:

less

Transcript and Presenter's Notes

Title: MATLAB FOR PATTERN RECOGNITION


1
MATLAB FOR PATTERN RECOGNITION
  • By Özge Öztimur

2
How Much Do We Know?
  • Anybody who has never used MATLAB?

3
MATLAB Environment
  • Workspace Variables defined so far.
  • Command History
  • Command Window
  • Edit Window
  • Plot Window
  • Current Directory Start by setting the current
    directory to the directoy that you are working.
    Generally, it is where your files are.

4
LOOKFOR HELP
  • LOOKFOR Type lookfor smth to learn the name of
    functions that are related to smth.
  • HELP Type help function_name to learn how that
    function works, its inputs and outputs.

5
Everything is a Matrix
  • Each variable in MATLAB is a matrix.
  • For example
  • gtgt a1
  • gtgtsize(a)
  • ans
  • 1 1

6
Creating Matrices
  • gtgt a 1 2 2 1
  • a 1 2 2 1
  • gtgt b 1 2 2 1
  • b
  • 1
  • 2
  • 2
  • 1

7
Accessing a Matrix
  • gtgt a1 2 3 4
  • a
  • 1 2
  • 3 4
  • gtgt a(2,1)
  • ans
  • 3

8
Matrix Operations
  • Matrix operations like,
  • Matrix addition, subtraction, multiplication
  • Determinant of a matrix
  • Inverse of a matrix
  • Transpose of a matrix
  • Element by element multiplication, division
  • are defined in MATLAB.

9
Flow Control-IF
  • gtgt if ab5
  • m1
  • elseif ab3
  • m2
  • end
  • gtgt

10
Flow Control-Switch
  • gtgt switch (rem(n,4)0) (rem(n,2)0)
  • case 0
  • M0
  • case 1
  • M1
  • otherwise
  • M2
  • end

11
Loops
  • gtgt a 0.8 0.1 0.2 0.9
  • gtgt x 1 0
  • gtgt for i 120
  • x ax
  • end
  • Avoid using Loops in Matlab.

12
M-Files Scripts And Functions
  • Scripts Do not accept input arguments or return
    output arguments.They operate on data in the
    workspace.
  • M-Files can accept input arguments and return
    output arguments.Internal variables are local to
    the function.

13
Read Write Files
  • Load, Save,Saveas
  • Textread
  • There are many other functions for file
    operations. Check File I/O part in Mathworks
    Help.

14
Function Definition
  • Name of the function and the file should be the
    same.
  • functionoutput1,output2example(input)

15
Example Generating Random Numbers
  • Generate random numbers of size 5x3 (5 rows, 3
    columns)
  • gtgt arandn(5,3)

16
Example-Distributions
  • Parameter Estimation Examples
  • Normal Distribution
  • gtgtmu,sigmanormfit(data)
  • Binomial Distribution
  • gtgt phatbinofit(data,n)

17
Example-Probability Density Function
  • Pdf gives the probability density function for a
    specified distribution
  • gtgt Ypdf(name,X,A)
  • Where name is the name of the distribution, X is
    the data and A is the parameters for the given
    distribution.

18
Example-Maximum Likelihood Estimation
  • mle gives the maximum likelihood estimation
  • gtgt mle(data)
  • gtgt mle(data,distribution,dist)
  • Where dist is the name of the distribution

19
Graphical Representation
  • Generally plot is used for drawing graphics.
  • gtgtplot(x)
  • plots the columns of x versus their index.
  • Many options are provided for this
  • function.

20
Refer To
  • http//www.mathworks.com/access/helpdesk/help/help
    desk.html
  • Course Web Page
  • www.ceng.metu.edu.tr/courses/secondprog/ceng564/
Write a Comment
User Comments (0)
About PowerShow.com