Вы находитесь на странице: 1из 29

MATLAB TUTORIAL

WITH APPLICATION ON

ISOLATED-WORD RECOGNITION SYSTEM


2012.09.11 EE476 AUDIO-VISUAL PERCEPTION MODELS CHEONG-AN LEE

CONTENTS
1. Matlab Tutorial 2. Mel-Frequency Cepstral Coefficients (MFCC) 3. Dynamic Time Warping (DTW) 4. K-Nearest Neighbor (KNN)

REFERENCES
References (Uploaded on course webpage.) Getting Started with Matlab. Dynamic Time Warping Algorithm Review.

MATLAB (MATRIX LABORATORY)


The Language of Technical Computing MATLAB is a high-level language and interactive environment. Key Features High-level language for technical computing. Development environment for managing code, files, and data. 2-D and 3-D graphics functions for visualizing data.

MATLAB
Downloading and installation www.mathworks.com kftp.kaist.ac.kr

VARIABLES
>> a = 1 >> b = 2 >> c = a + b >> d = cos(a)

>> sin(a)
>> e = a * b; >>

MATRICES AND ARRAYS


Array Creation >> a = [1 2 3 4] >> a = [1, 2, 3, 4] >> a = [1 2 3; 4 5 6; 7 8 10]

>> b = zeros(3, 1)
>> b = ones(3) >> b = rand(2, 3)

MATRICES AND ARRAYS


Matrix and Array Operations >> a + 10 >> sin(a) >> a

>> p = a * inv(a)
>> p = a .* a >> a .^ 3

MATRICES AND ARRAYS


Concatenation A = [a, a] A = [a; a]

Complex Numbers
c = [3 + 4i, 4 + 3j, -i, 10j]

MATRICES AND ARRAYS


Array Indexing >> A = rand(3) >> A(3, 2) >> A (4)

>> A(3, 4) = 0.8


>> A(1 : 3, 2) >> A(3, :) >> B = 0:10:100

WORKSPACE
>> whos >> save myfile.mat >> clear >> load myfile.mat

CHARACTER STRINGS
>> myText = Hello, world >> otherText = Youre right >> longText = [myText, , otherText] >> a = 3;

>> numberText = [a is num2str(a)]

FUNCTIONS
>> A = [1 3 5] >> B = [10 6 4] >> maxA = max(A) >> [maxA, location] = max(A)

PLOTS
Line Plots >> x = 0 : pi / 100 : 2 * pi; >> y = sin(x); >> plot(x, y)

>> xlabel(x);
>> ylabel(sin(x)); >> title(Plot of the Sine Function); >> plot(x, y, r-o); >> hold on; >> y2 = cos(x); >> plot(x, y2);

SCRIPTS
Sample Script >> edit plotrand % Generate random data from a uniform distribution. n = 50;

r = rand(n, 1);
plot(r); >> plotrand

SCRIPTS
Loops and Conditional Statements

a = rand(3, 1) - 0.5;
for i = 1 : length(a) if a > 0 a(i) = i * a(i);

elseif a > -0.1


a(i) = a(i) ^ i; else a(i) = 0; end end while length(a) < 5 a(end + 1) = rand; end

SCRIPTS
Script Locations >> addpath([pwd \mypath]);

FUNCTION
function [a, b] = myFunc(c) a = 2 * c; b = 3 * a;

HELP
>> doc mean >> help mean

SPEECH RECOGNITION SYSTEMS


Task dependent speech recognition. Large vocabulary continuous speech recognition. Isolated-word recognition.

ISOLATED-WORD RECOGNITION
Feature Extraction
0.8 0 6 0.6 500 5 0.4 1000 1500 2000 2500 2 3000 3500 4000 0 0.5 1 1.5 2 2.5 x 10
4

Spectrogram

x 10

-4

0.2

Frequency (Hz)

-0.2

-0.4

-0.6

0.5

1.5 Time (sec)

2.5

Classification
Spectrogram 0 6 500 5 1000 1500 2000 2500 2 3000 3500 4000 0.5 1 1.5 Time (sec) 2 2.5 1 4 x 10
-4

Frequency (Hz)

Three

MFCC
0.8 0.6

0.4

0.2

-0.2

-0.4

-0.6

0.5

1.5

2.5 x 10
4

frameLen

MFCC
0.8 0.6

0.4

0.2

-0.2

-0.4

-0.6

0.5

1.5

2.5 x 10
4

frameShift

MFCC
Spectrogram 0 6
500

x 10

-4
0 0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

500 5 1000 1500 2000 2500 2 3000 3500 4000 0.5 1 1.5 Time (sec) 2 2.5 1 4

20

1000 1500

40

Frequency (Hz)

60
2000

80

2500 3000 3500 4000

100

120 50 100 150 200 250

MFCC
Spectrogram 0 6
500

x 10

-4
0 0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

500 5 1000 1500 2000 2500 2 3000 3500 4000 0.5 1 1.5 Time (sec) 2 2.5 1 4

20

1000 1500

40

Frequency (Hz)

60
2000

80

2500 3000 3500 4000

100

120 50 100 150 200 250

DTW
1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8

0.5

1.5

2.5 x 10
4

1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8

0.5

1.5

2.5 x 10

3
4

KNN

KNN

HOMEWORK1-2
Make function function recogRate = IWRS(pathToDB); recogRate = TheNumberOfRightAnswers / TheNumberOfTestSamples 3~5 page report Understand MFCC. What happened if you change parameters.
Intermediate results and final results (recognition rate).

Why it happened.

Вам также может понравиться