Sunteți pe pagina 1din 37

AIM: To understand fuzzy logic system by using Matlabs Fuzzy Logic toolbox.

1.0

OBJECTIVES After completing this units, students should be able to: . To determine fuzzy !ariables, form the rule base and use fuzzy reasoning to chec" the operability of the rule base. #. To construct fuzzy logic system by using Matlabs fuzzy logic toolbox.

FACULTY OF ELECTRICAL AND ELECTRONIC ENGINEERING


2.0 THEORY DEPARTMENT OF COMPUTER ENGINEERING $lease refer lectures notes. 3.0

MASTERS LABORATORY 1 (MEE 10501) EQUIPMENT LIST:


%. %.# $ersonal computer LABORATORY REPORT Matlab Fuzzy Logic Toolbox

Code of Cour e MEE 10501 4.0 EXPERIMENT PROCEDURE N!"e Cour "%&'()* e MASTERS LABORATORY 1 Tas 1 : of T!""!#$ The &uality of ser!ice in restaurant is e!aluated according to scale '( ', )here ' mean ZAHARI BIN HASAN GE120194 excellent and ' poor ser!ice. The &uestion is, ho) much tip )e should gi!e, that the relation N!"e tip of and S#ude$# bet)een ser!ice is correct. *reate F+, )ith -.+ follo)ing rules belo)/ There are three main rules: i0 +f the ser!ice is poor, the tip is cheap. of E'(er%"e$# NEURAL NETWORK APPLICATION ii0T%#&e +f the ser!ice is good, the tip is a!erage. iii0 +f the ser!ice is excellent, the tip is generous. No) of E'(er%"e$# CI 02 According to ., practice, the cheap tip is 12, a!erage 12 and generous #12 of the total bill. Formulate fuzzy deduction system 3tip. .se Matlab Fuzzy Logic Toolbox. N!"e of Le*#urer DR ABD. KADIR BIN MAHAMAD

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

The F+, )ith -.+ )as created referring to the three rules gi!en. Tas 2: +URNACE TEMPERATURE CONTROL AIM: T& ,#-)%s.a#- s)/)%a( .0")s &1 #),%a( #).2&% *&-)(s '0 ,s!#$ Ma.(a'3s #),%a( #).2&% .&&('&4. 1.0 OBJECTIVES After completing this unit, students should be able: . To apply some basic neuron models and learning algorithms by using Matlabs neural net)or" toolbox. #. To demonstrate multi(layer feedfor)ard 4MLFF0 neural net)or"s by using Matlabs neural net)or" toolbox. %. To practice clustering )ith a self(organizing feature map and pattern association )ith a 5opfield net)or".

2.0 THEORY $lease refer lectures notes. 3.0 EQUIPMENT LIST: %. $ersonal *omputer %.# Matlab 6eural 6et)or" Toolbox 4.0 EXPERIMENT PROCEDURE 7efer to Labsheet

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

5.0

RESULT AND DISCUSSION

TOPIC 1 : SIMPLE NEURON MODELS AND LEARNIN6 AL6ORITHMS TAS7 1 : DEMONSTRATION IN MATLAB A. S!*"() #),%&# a#- .%a#s1)% 1,#8.!&#s

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

For the first tas", $urelin transfer function )as selected. The )eight and bias of # are pic"ed. The output are li"e belo):

8ith the same transfer function, )e!e changed the bias into '.

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

8e can se that the border line changed by :(axis to '. Then )e changed the )eight to .

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

8e can see that the degree of gradient changed depending on the )eight !alue

1. H&2 .9) 2)!$9.s a#- '!as /a(,)s a11)8. .9) &,.",. &1 a #),%&#. The )eight are the !alue of the m, that is the gradient of the border line. 8hile the bias is the !alue of c, that is the border line interception on :(axis.

6ext, 5ardlim transfer function )as selected. The )eight and bias of # are pic"ed. The output are li"e belo):

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

The hardlimit function graph are little bit bac")ard in <!e plane. 6o) )e changed the )eight to '.

The output seems li"e are all !alue of . Then )e changed the bias !alue to '

The output became li"e figure and )e can see there are area of ' !alue and changed )eight !alue to (#.

!alue. Then

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

The output sho)n the !alue of

in the negati!e side. Then )e changed the bias !alue to (#.

The output sho) hardlimit !alue in negati!e side

JEP, FKEE (Semester 1 2012/2013)

>

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

1. H&2 .9) 2)!$9.s a#- '!as /a(,)s a11)8. .9) &,.",. &1 a #),%&#.

The )eight determine the side of positi!e !alue )here )hen )eight !alue is positi!e, the !alue of are to)ard positi!e area and !ice !ersa. 8hile the bias determining the point of !alue change from ' to . 8hen the bias !alue is positi!e, the change point of !alue is in the negati!e area and !ice !ersa.

B. N),%&# 2!.9 /)8.&% !#",.

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Ha%-(!* a#- Ha%-(!*s .%a#s1)% 1,#8.!&#s.

a: 1 P,%)(!# a#- Sa.(!# .%a#s1)% 1,#8.!&#s.

a: 1

a: 3 Sa.(!#s a#- L&$s!$ .%a#s1)% 1,#8.!&#s.

a: 1

JEP, FKEE (Semester 1 2012/2013)

'

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

a: 1

a: 1

Ta#s!$ .%a#s1)% 1,#8.!&#s.

a: 1

2. H&2 .9) 89&!8) &1 a8.!/a.!&# 1,#8.!&# ;&% .%a#s1)% 1,#8.!&#< a11)8.s .9) &,.",. &1 a

#),%&#.E4")%!*)#. 2!.9 .9) 1&((&2!#$ 1,#8.!&#s: !-)#.!.0 ;",%)(!#<= '!#a%0

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

.9%)s9&(- ;9a%-(!*= 9a%-(!*s<a#- s!$*&!- ;(&$s!$= .a#s!$<. The choice of acti!ation function affect the output of the neuron depend on the each acti!ation function graph )here the output !alue depend on input !alue through the acti!ation graph.

C. P)%8)".%&# ()a%#!#$ %,()

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Learn button 8ithout bias

)ith bias

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

3. H&2 -)8!s!&# '&,#-a%0 89a#$)s -,%!#$ .%a!#!#$ 2!.9 .9) ")%8)".%&# ()a%#!#$ %,().

@ecision boundary changes by testing e!ery points until its satisfy each point.

D. C(ass!1!8a.!&# 2!.9 a 2>!#",. ")%8)".%&#

JEP, FKEE (Semester 1 2012/2013)

>

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

4. H&2 .9) ")%8)".%&# ()a%#!#$ %,() 2&% s 1&% (!#)a%(0 s)"a%a'() "%&'()*s.

For linearly separable problems, perceptron learning rule )or"s by di!iding the area by classified input.

E. L!#)a%(0 #&#>s)"a%a'() /)8.&%s

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

5. H&2 .9) ")%8)".%&# ()a%#!#$ %,() 2&% s 1&% #&#>(!#)a%(0 s)"a%a'() "%&'()*s.

The perceptron learning rule test all the point and cannot classify the input by di!iding the area as there are no linear border to classify the input.

TAS7 2 : TRAININ6 THE PERCEPTRON @uring this tas" )e ha!e to study the beha!ior of the perceptron learning rule in t)o

JEP, FKEE (Semester 1 2012/2013)

#'

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

difference classification problems. $ data. T data.

$ data.

T data.

The output $ e!en after ''' epoch

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

The output $# e!en after ''' epoch

1. D&)s .9) .%a!#!#$ 8&#/)%$)? Anly $ can con!erge.


JEP, FKEE (Semester 1 2012/2013)

##

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

2. Is .9) ")%8)".%&# a'() .& 8(ass!10 a(( .%a!#!#$ /)8.&%s 8&%%)8.(0 a1.)% .%a!#!#$? 6o 3. I1 #&.= 290? Because the !ectors cannot be classified and di!ided by linear line 4. Ca# 0&, sa0 s&*).9!#$ a'&,. .9) ")%8)".%&#3s a'!(!.0 .& 8(ass!10 #)2 ,# #&2# "a..)%#s? ;#&.) .9) "&s!.!&# &1 .9) -)8!s!&# (!#)< $erceptrons rule is guaranteed to con!erge to a solution that correctly categorizes the training patterns but the resulting net)or" can be sensiti!e to noise as patterns often lie close to the decision boundary.

5.1

TOPIC 2 : MULTI @LAYER +EED+ORAARD NEURAL NETAOR7

JEP, FKEE (Semester 1 2012/2013)

#%

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

TAS7 1 : PATTERN RECO6NITION AITH ML++ NETAOR7 *reate feed for)ard neural net )ith one hidden layer, % nodes in hidden layer, )ith tangent sigmoid as transfer function in hidden layer and linear function for output layer, and )ith gradient descent )ith momentum bac" propagation training function.

. 7ecord the number of epochs, the mean s&uared error 4M,C0 and the classification result 4using rate0. E"&89 '' #'' %'' 9'' 1'' ;'' ='' >'' ?'' ''' MSE 9.;9e('; #.9;e('> .'>e( 9 9.#9e('; 9.'=e('; #.'>e('? 9. 'e('= .=#e('; .>%e('1 .;%e('1

#. *omment the result: The expected !alue of the s&uared error loss or &uadratic loss. M,C

JEP, FKEE (Semester 1 2012/2013)

#9

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

measures the a!erage of the s&uares of the Derrors.D Cpoch E '', M,C E 9.;9e('; Cpoch E #'', M,C E #.9;e('>

Cpoch E %'', M,C E .'>e( 9

Cpoch E 9'', M,C E 9.#9e(';

Cpoch E 1'', M,C E 9.'=e(';

Cpoch E ;'', M,C E #.'>e('?

JEP, FKEE (Semester 1 2012/2013)

#1

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Cpoch E ='', M,C E 9. 'e('=

Cpoch E >'', M,C E .=#e(';

JEP, FKEE (Semester 1 2012/2013)

#;

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Cpoch E ?'', M,C E .>%e('1

Cpoch E ''', M,C E .;%e('1

%. 7epeat the experiment. E"&89 '' #'' %'' 9'' 1'' ;'' ='' >'' ?'' ''' *ommnet 6ot consistence , the result depend an estimator is one of many )ays to &uantify the difference bet)een !alues implied by an estimator and the true !alues of the &uantity being estimated. MSE;.)s.1< 9.;9e('; #.9;e('> .'>e( 9 9.#9e('; 9.'=e('; #.'>e('? 9. 'e('= .=#e('; .>%e('1 .;%e('1 MSE;.)s.2< '.'''#1 >.1=e('1 .>?e('> '.'''#?9 =.;#e(#' .%#e('; ;.>1e('> #.>9e( ' ;.>1e('> %.'9e('1

JEP, FKEE (Semester 1 2012/2013)

#=

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Cpoch E '', M,C E '.'''#1

Cpoch E #'', M,C E '.'''#1

Cpoch E %'', M,C E .>?e('>

Cpoch E 9'', M,C E '.'''#?9

JEP, FKEE (Semester 1 2012/2013)

#>

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Cpoch E 1'', M,C E =.;#e(#'

Cpoch E ;'', M,C E .%#e(';

Cpoch E ='', M,C E ;.>1e('>

Cpoch E >'', M,C E #.>9e( '

JEP, FKEE (Semester 1 2012/2013)

#?

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

Cpoch E ?'', M,C E ;.>1e('>

Cpoch E ''', M,C E %.'9e('1

TAS7 2 : +UNCTION APPROXIMATION

JEP, FKEE (Semester 1 2012/2013)

%'

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

-eneralization +n!estigate ho) the number of neurons affects the ability of a MLFF to generalize 4that is, to classify unseen pattern !ectors0. The tas" of the net)or" is to approximate the follo)ing function y E x F '.% sin4# x0 For this tas" )e are trying to )or" out )ith the code belo)/

1. P(&. .9) %)s,(. !# .9) sa*) $%a"9 .9a. 0&, 9a/) ,s)- 1&% "(&..!#$ .9) 1,#8.!&# a#.%a!#!#$ -a.a= !.).= "(&. B as a 1,#8.!&# &1 4. ;).$.= %)- (!#)<. C&*",.) a(s& .9) s,*>sC,a%)- )%%&% &# .9) .)s. s).,s!#$ s,*sC%;B>0.<. Is .9) a""%&4!*a.!&# $&&-? C&**)#..

JEP, FKEE (Semester 1 2012/2013)

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

6umber of neuron in hidden layer E *omment: The approximation is good because the net)or" reaches its maximum capabality.

2. D& .9) sa*) !#!.!a(!Ba.!&#= .%a!#!#$ a#- .)s.!#$ "%&8)-,%) as a'&/) ',. 1&% -!11)%)#. #,*')% &1 #),%&#s !# .9) 9!--)# (a0)%: 2=3=4=5=D=E=F=G=10 a#- 50. T9) $%a"9 &1 .9) a""%&4!*a.!&# .&$).9)% 2!.9 .9) %)a( 1,#8.!&# a#- .%a!#!#$ -a.a s9&,(- ') "%)s)#.)- !# .9) %)"&%.. D!s8,ss .9) $)#)%a(!Ba.!&# ")%1&%*a#8) &1 .9) #).2&% !# )a89 8as) H ).$.= -&)s !. ,#-)%1!. &% &/)%1!. .9) -a.a?

JEP, FKEE (Semester 1 2012/2013)

%#

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

6um of neuron in hidden layer E#

6um of neuron in hidden layer E%

6um of neuron in hidden layer E9

6um of neuron in hidden layer E 1

JEP, FKEE (Semester 1 2012/2013)

%%

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

6um of neuron in hidden layer E ;

6um of neuron in hidden layer E =

6um of neuron in hidden layer E >

6um of neuron in hidden layer E ?

JEP, FKEE (Semester 1 2012/2013)

%9

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

6um of neuron in hidden layer E ' O's)%/a.!&#:

6um of neuron in hidden layer E 1'

As )e can see from the graf, )hen the !alue of hidden neuron is increasing the the net)or" reaches its maximum capabilty. The mean s&uare error is minimized , but the net)or" response is only able to match a small part of the function. 3. A9!89 #).2&% $a/) .9) ')s. %)s,(.s? Y&, s9&,(- a(s& s9&2 a .a'() &% $%a"9 s9&2!#$ .9) SSE a$a!#s. .9) #,*')% &1 9!--)# #),%&#s. N,* &1 SSE;")%1&%*a#8)< N),%&# !# .9) H!--)# La0)% # '.' ;; % '.' ' 9 '.' '= 1 '.''9=9 ; '.'';; = '.''9=> > '.''9 ' ? '.''9=1 ' '.' ' 1' .'=e(%'

JEP, FKEE (Semester 1 2012/2013)

%1

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

6um of neuron in hidden layer E 1' The net)or" )hich is had a number of neuron in hidden layer E 1' got the best result for the approximination together )ith the real function.

JEP, FKEE (Semester 1 2012/2013)

%;

F!*u&#+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$, Ex !"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION

D.0 DISCUSSION 6eural net)or"s are composed of simple elements operating in parallel. These elements are inspired by biological ner!ous systems. As in nature, the net)or" function is determined largely by the connections bet)een elements. 8e can train a neural net)or" to perform a particular function by adGusting the !alues of the connections 4)eights0 bet)een elements. *ommonly neural net)or"s are adGusted, or trained, so that a particular input leads to a specific target output. ,uch a situation is sho)n belo). There, the net)or" is adGusted, based on a comparison of the output and the target, until the net)or" output matches the target. Typically many such inputHtarget pairs are used, in this super!ised learning, to train a net)or". 6eural 6et)or" Toolbox pro!ides functions and apps for modeling complex nonlinear systems that are not easily modeled )ith a closed(form e&uation. 6eural 6et)or" Toolbox supports super!ised learning )ith feedfor)ard, radial basis, and dynamic net)or"s. +t also supports unsuper!ised learning )ith self(organizing maps and competiti!e layers. 8ith the toolbox you can design, train, !isualize, and simulate neural net)or"s. :ou can use 6eural 6et)or" Toolbox for applications such as data fitting, pattern recognition, clustering, time(series prediction, and dynamic system modeling and control.

E.0 CONCLUSION From this lab student able to apply some basic neuron models and learning algorithms by using Matlabs neural net)or" toolbox and demonstrate multi(layer feedfor)ard 4MLFF0 neural net)or"s by using Matlabs neural net)or" toolbox. ,tudent also able to practice clustering )ith a self(organizing feature map and pattern association )ith a 5opfield net)or".

F.0 RE+ERENCE 9..":II222.*a.92&% s.8&*I9)("I"-1J-&8I#),%a(

JEP, FKEE (Semester 1 2012/2013)

%=

S-ar putea să vă placă și