CHAPTER5
CHAPTER5
CHAPTER5
¨±. 5.3. ¨ «®£®¢®¥ ®ª® § ¤ ¨¿ ²¨¯ ¨ ª®«¨·¥±²¢ ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨
¤¢¨¦ª Á ¤¥« ¥²±¿ ¢¥±¼¬ ¯°®±²®: ¯®¤¢®¤¨¬ ª³°±®° ª ³¦®© ª°¨-
¢®© ¨ ¹¥«ª ¥¬ «¥¢®© ª®¯ª®© ¬»¸¨. °¨¢ ¿ ¢»¡¨° ¥²±¿, ®ª° ¸¨-
¢ ¿±¼ ¢ ª° ±»© ¶¢¥², ¯®±«¥ ·¥£® ± ¯®¬®¹¼¾ ª³°±®° ¥¥ ¨ ¬®¦®
5.2. ° ´¨·¥±ª¨© ¨²¥°´¥©± Fuzzy Logic Toolbox 167
¯®¤¢¨³²¼ ¢ ³¦³¾ ±²®°®³ (¡®«¥¥ ²®·³¾ ³±² ®¢ª³ ¬®¦® ¯°®-
¢¥±²¨, ¨§¬¥¿¿ ·¨±«®¢»¥ § ·¥¨¿ ¢ ¯®«¥ Params ( ° ¬¥²°») |
¢ ¤ ®¬ ±«³· ¥ ª ¦¤®© ´³ª¶¨¨ ¯°¨ ¤«¥¦®±²¨ ±®®²¢¥²±²¢³¾²
¤¢ ¯ ° ¬¥²° , ¯°¨ ½²®¬ ¯¥°¢»© ®¯°¥¤¥«¿¥² ° §¬ µ ª°¨¢®©, ¢²®-
°®© | ¯®«®¦¥¨¥ ¥¥ ¶¥²° ). «¿ ¢»¡° ®© ª°¨¢®©, ª°®¬¥ ½²®£®,
¢ ¯®«¥ Name ¬®¦® ¨§¬¥¿²¼ ¨¬¿ (§ ¢¥°¸ ¿ ¢¢®¤ ª ¦¤®£® ¨¬¥¨
¦ ²¨¥¬ ª« ¢¨¸¨ Enter). °®¤¥« ¥¬ ²°¥¡³¥¬»¥ ¯¥°¥¬¥¹¥¨¿
ª°¨¢»µ ¨ § ¤ ¤¨¬ ¢±¥¬ ¯¿²¨ ª°¨¢»¬ ®¢»¥ ¨¬¥ , ¯°¨¬¥°:
± ¬®© «¥¢®© | bn,
±«¥¤³¾¹¥© | n,
¶¥²° «¼®© | z,
±«¥¤³¾¹¥© § ¥© ±¯° ¢ | p,
± ¬®© «¥¢®© | bp.
¦¬¥¬ ª®¯ª³ Close ¨ ¢»©¤¥¬ ¨§ °¥¤ ª²®° ´³ª¶¨© ¯°¨-
¤«¥¦®±²¨, ¢®§¢° ²¨¢¸¨±¼ ¯°¨ ½²®¬ ¢ ®ª® °¥¤ ª²®° ¥·¥²ª®©
±¨±²¥¬» (FIS Editor).
6. ¤¥« ¥¬ ®¤®ª° ²»© ¹¥«·®ª «¥¢®© ª®¯ª®© ¬»¸¨ ¯® £®«³-
¡®¬³ ª¢ ¤° ²³ (¡«®ª³), ®§ £« ¢«¥®¬³ output1 (¢»µ®¤1). ®ª®¸-
ª¥ Name § ¬¥¨¬ ¨¬¿ output1 y (ª ª ¢ ¯³ª²¥ 2).
7. ¢ ¦¤» ¹¥«ª¥¬ ¯® ®²¬¥·¥®¬³ ¡«®ª³ ¨ ¯¥°¥©¤¥¬ ª ¯°®-
£° ¬¬¥ | °¥¤ ª²®°³ ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨. ¯®§¨¶¨¨ ¬¥¾
Edit ¢»¡¥°¥¬ ®¯¶¨¾ Add MFs. ®¿¢«¿¾¹¥¥±¿ ¤¨ «®£®¢®¥ ®ª®
¢¨¤ °¨±. 5.3 ¯®§¢®«¿¥² § ¤ ²¼ ²¥¯¥°¼ ¢ ª ·¥±²¢¥ ´³ª¶¨© ¯°¨ ¤-
«¥¦®±²¨ ²®«¼ª® «¨¥©»¥ (linear) ¨«¨ ¯®±²®¿»¥ (constant) |
¢ § ¢¨±¨¬®±²¨ ®² ²®£®, ª ª®© «£®°¨²¬ Sugeno (1-£® ¨«¨ 0-£® ¯®-
°¿¤ª ) ¬» ¢»¡¨° ¥¬. ° ±±¬ ²°¨¢ ¥¬®© § ¤ ·¥ ¥®¡µ®¤¨¬® ¢»-
¡° ²¼ ¯®±²®¿»¥ ´³ª¶¨¨ ¯°¨ ¤«¥¦®±²¨ ± ®¡¹¨¬ ·¨±«®¬ 4 (¯®
·¨±«³ ° §«¨·»µ § ·¥¨© y ¢ ² ¡«. 5.1). ®¤²¢¥°¤¨¬ ¢¢¥¤¥»¥
¤ »¥ ¦ ²¨¥¬ ª®¯ª¨ OK, ¯®±«¥ ·¥£® ¯°®¨§®©¤¥² ¢®§¢° ² ¢
®ª® °¥¤ ª²®° ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨.
8. ¡° ²¨¬ ¢¨¬ ¨¥, ·²® §¤¥±¼ ¤¨ ¯ §® (Range) ¨§¬¥¥¨¿,
³±² ¢«¨¢ ¥¬»© ¯® ³¬®«· ¨¾ | [0, 1], ¬¥¿²¼ ¥ ³¦®. §-
¬¥¨¬ «¨¸¼ ¨¬¥ ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨ (¨µ £° ´¨ª¨ ¯°¨
¨±¯®«¼§®¢ ¨¨ «£®°¨²¬ Sugeno ¤«¿ ¢»µ®¤»µ ¯¥°¥¬¥»µ ¥
¯°¨¢®¤¿²±¿), ¯°¨¬¥°, § ¤ ¢ ¨µ ª ª ±®®²¢¥²±²¢³¾¹¨¥ ·¨±«®¢»¥
§ ·¥¨¿ y , ². ¥. 0, 0.16, 0.36, 1; ®¤®¢°¥¬¥® ½²¨ ¦¥ ·¨±«®¢»¥
§ ·¥¨¥ ¢¢¥¤¥¬ ¢ ¯®«¥ Params (°¨±. 5.4). ²¥¬ § ª°®¥¬ ®ª®
¦ ²¨¥¬ ª®¯ª¨ Close ¨ ¢¥°¥¬±¿ ¢ ®ª® FIS-°¥¤ ª²®° .
9. ¢ ¦¤» ¹¥«ª¥¬ «¥¢®© ª®¯ª®© ¬»¸¨ ¯® ±°¥¤¥¬³ (¡¥-
«®¬³) ¡«®ª³, ¯°¨ ½²®¬ ° ±ª°®¥²±¿ ®ª® ¥¹¥ ®¤®© ¯°®£° ¬¬» |
°¥¤ ª²®° ¯° ¢¨« (Rule Editor). ¢¥¤¥¬ ±®®²¢¥²±²¢³¾¹¨¥ ¯° -
¢¨« . °¨ ¢¢®¤¥ ª ¦¤®£® ¯° ¢¨« ¥®¡µ®¤¨¬® ®¡®§ ·¨²¼ ±®®²-
168 «.5. ª¥² FUZZY LOGIC TOOLBOX
¢¥²±²¢¨¥ ¬¥¦¤³ ª ¦¤®© ´³ª¶¨¥© ¯°¨ ¤«¥¦®±²¨ °£³¬¥² x
¨ ·¨±«®¢»¬ § ·¥¨¥¬ y . °¨¢ ¿, ®¡®§ ·¥ ¿ ¬¨ bn, ±®®²-
¢¥²±²¢³¥² x = ,1, ². ¥. y = 1. »¡¥°¥¬, ¯®½²®¬³ ¢ «¥¢®¬ ¯®«¥
¨±. 5.8. ¨¤ ®ª FIS-°¥¤ ª²®° ¯®±«¥ § ¤ ¨¿ ±²°³ª²³°» ±¨±²¥¬»
±²³¯ ¿ ª ª ° ¥¥, § ¤ ¤¨¬ ¤¢¥ ´³ª¶¨¨ ¯°¨ ¤«¥¦®±²¨ ²° ¯¥-
¶¥¨¤ «¼®© ´®°¬» ± ¯ ° ¬¥²° ¬¨, ±®®²¢¥²±²¢¥®, [0 0 1 3] ¨
[7 9 10 10] ¨ ¨¬¥ ¬¨ À¯®¤£®°¥¢¸ ¿Á ¨ À¯°¥¢®±µ®¤ ¿Á.
«¿ ¢»µ®¤®© ¯¥°¥¬¥®© À· ¥¢»¥Á ³ª ¦¥¬ ± · « ¤¨ ¯ §®
¨§¬¥¥¨¿ | ®² 0 ¤® 30, ¯®²®¬ § ¤ ¤¨¬ ²°¨ ´³ª¶¨¨ ¯°¨ ¤-
«¥¦®±²¨ ²°¥³£®«¼®© ´®°¬» ± ¨¬¥ ¬¨ À¬ «»¥Á, À±°¥¤¨¥Á, À¹¥-
¤°»¥Á ² ª, ª ª ½²® ¯°¥¤±² ¢«¥® °¨±. 5.9. ¬¥²¨¬, ·²® ¬®¦®,
174 «.5. ª¥² FUZZY LOGIC TOOLBOX
° §³¬¥¥²±¿, § ¤ ²¼ ¨ ª ª¨¥-«¨¡® ¤°³£¨¥ ´³ª¶¨¨ ¨«¨ ¢»¡° ²¼ ¨µ
¤°³£¨¥ ¯ ° ¬¥²°».
¨±. 5.16. ª® ANFIS-°¥¤ ª²®° ¯®±«¥ § £°³§ª¨ ®¡³· ¾¹¥© ¢»¡®°ª¨
¨±. 5.21. ¥§³«¼² ² ° ¡®²» ¯°®£° ¬¬» Clustering (¶¥²°» ª« ±²¥°®¢ ®ª° ¸¥»
¢ ·¥°»© ¶¢¥²)
188 «.5. ª¥² FUZZY LOGIC TOOLBOX
ª« ±²¥°¨§ ¶¨¿Á). ±«¨ ¥ ¢¤ ¢ ²¼±¿ ¢ ¨µ ¤¥² «¼®¥ ²¥®°¥²¨·¥-
±ª®¥ ¨§«®¦¥¨¥, ®£° ¨·¨²¼±¿ ¢»¿¢«¥¨¥¬ ° §«¨·¨© ³°®¢¥
¯®«¼§®¢ ²¥«¿, ²® ¬®¦® ®²¬¥²¨²¼, ·²® «£®°¨²¬ Fuzzy c-means,
¿¢«¿¿±¼, ¯®¦ «³©, ¡®«¥¥ ²®·»¬ (¥±«¨ ¯®¿²¨¥ ²®·®±²¨ ¢®®¡¹¥
§¤¥±¼ ¯°¨¬¥¨¬®), ¤«¿ ±¢®¥© ° ¡®²» ²°¥¡³¥² § ¤ ¨¿ ² ª¨µ ®¯-
¶¨©, ª ª ·¨±«® ª« ±²¥°®¢ (ª®¯ª Cluster num.) ¨ ·¨±«® ¨²¥° ¶¨©
(ª®¯ª Max Iteration#). ³, ¥±«¨ ·¨±«® ¨²¥° ¶¨© ¥¹¥ ¬®¦®
§ ¤ ²¼ ª ª-²® ³£ ¤, ²® ®¸¨¡ª ¢ § ¤ ¨¨ ·¨±« ª« ±²¥°®¢ ¬®-
¦¥² ¯°¨¢¥±²¨ ª ¥¯°¨¿²»¬ ¯®±«¥¤±²¢¨¿¬. «£®°¨²¬ Subtrac-
tive clustering ¬¥¥¥ ²®·¥, ® ¨ ¬¥¥¥ ²°¥¡®¢ ²¥«¥ ª ¯°¨®°®©
¨´®°¬ ¶¨¨; ¯°¨ ° ¡®²¥ ± ¨¬ ¬®¦® ±®µ° ¨²¼ ®¯¶¨¨, § ¤ -
»¥ ¢ ¯°®£° ¬¬¥ ¯® ³¬®«· ¨¾. °¨±. 5.21 ¯°¨¢¥¤¥ ¯°¨¬¥°
¨±¯®«¼§®¢ ¨¿ ¯°®£° ¬¬» ¤«¿ ´ « ¤ »µ clusterdemo.dat ¨§
¤¨°¥ª²®°¨¨ Matlab/toolbox/fuzzy/fuzdemos/ ¯°¨ ¨±¯®«¼§®¢ ¨¨
«£®°¨²¬ Subtractive clustering. ¬¥²¨¬, ·²® ¢»¢®¤¨²±¿ ²®«¼ª®
¤¢³¬¥°®¥ ¯®«¥ ° ±±¥¿¨¿, ® ¨§¬¥¿¿ ¯¥°¥¬¥»¥ ¢ ±®®²¢¥²±²¢³-
¾¹¨µ ¯®«¿µ (X-axis ¨ Y-axis), ¬®¦® À¯°®±¬®²°¥²¼Á ¢±¥ ¬®£®-
¬¥°®¥ ¯°®±²° ±²¢® ¯¥°¥¬¥»µ.
5.5. ¡®² ± Fuzzy Logic Toolbox
¢ °¥¦¨¬¥ ª®¬ ¤®© ±²°®ª¨
5.5.1. ®§¬®¦®±²¨ ° ¡®²» ¢ °¥¦¨¬¥ ª®¬ ¤®© ±²°®ª¨. ª¥²
Fuzzy Logic ° ±¯®« £ ¥² ¡®«¼¸¨¬ ¡®°®¬ ´³ª¶¨©, ¨±¯®«¿¥¬»µ
¨§ ª®¬ ¤®© ±²°®ª¨ MATLAB ¨ ¯®§¢®«¿¾¹¨µ, ¢ ¯°¨¶¨¯¥, ¥
¨±¯®«¼§®¢ ²¼ ¯°¨ ° ¡®²¥ ± ±¨±²¥¬ ¬¨ ¥·¥²ª®£® ¢»¢®¤ ° ±±¬®-
²°¥»¥ ¯°®£° ¬¬» £° ´¨·¥±ª®£® ¨²¥°´¥©± . ±¥ ´³ª¶¨¨ ¤¥-
«¿²±¿ £°³¯¯»:
1) ¢»§®¢ ¯°®£° ¬¬ £° ´¨·¥±ª®£® ¨²¥°´¥©± ;
2) § ¤ ¨¿ ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨;
3) ±®§¤ ¨¿, °¥¤ ª²¨°®¢ ¨¿, ¯°®±¬®²° , ®²ª°»²¨¿ ¨ ±®µ° ¥-
¨¿ ±¨±²¥¬ ¥·¥²ª®£® ¢»¢®¤ ;
4) ¤®¯®«¨²¥«¼»¥;
5) ° §«¨·»¥;
6) ¢»§®¢ ¤¨ «®£®¢»µ ®ª® ¨²¥°´¥©± ;
7) ¡«®ª®¢ Simulink;
8) ¤¥¬®±²° ¶¨¨ ¢®§¬®¦®±²¥© ¯ ª¥² .
5.5.2. ³ª¶¨¨ ¢»§®¢ ¯°®£° ¬¬ £° ´¨·¥±ª®£® ¨²¥°´¥©± .
½²®© £°³¯¯¥ ®²®±¿²±¿ ´³ª¶¨¨:
fuzzy | ¢»§®¢ FIS-°¥¤ ª²®° ;
mfedit | ¢»§®¢ °¥¤ ª²®° ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨;
ruleedit | ¢»§®¢ °¥¤ ª²®° ¯° ¢¨«;
ruleview | ¢»§®¢ ¯°®£° ¬¬» ¯°®±¬®²° ¯° ¢¨«;
5.5. ¡®² ± Fuzzy Logic Toolbox ¢ °¥¦¨¬¥ ª®¬ ¤®© ±²°®ª¨ 189
surfview | ¢»§®¢ ¯°®£° ¬¬» ¯°®±¬®²° ¯®¢¥°µ®±²¨ ®²ª«¨ª ;
an sedit | ¢»§®¢ ANFIS-°¥¤ ª²®° (²®«¼ª® ¤«¿ ±¨±²¥¬, ¨±-
¯®«¼§³¾¹¨µ «£®°¨²¬ Sugeno ¨ ¨¬¥¾¹¨µ ®¤³ ¢»µ®¤³¾ ¯¥°¥-
¬¥³¾);
ndcluster | ¢»§®¢ ¯°®£° ¬¬» ª« ±²¥°¨§ ¶¨¨.
±¯®«¼§®¢ ¨¥ ¯¥°¢»µ ¸¥±²¨ ´³ª¶¨© ± °£³¬¥²®¬ ( ¯°¨-
¬¥°, fuzzy(a), £¤¥ a | ¨¬¿ ¯¥°¥¬¥®© ° ¡®·¥£® ¯°®±²° ±²¢ ,
¯°¨±¢®¥®¥ ±¨±²¥¬¥ ¥·¥²ª®£® ¢»¢®¤ ), ®²ª°»¢ ¥² ±®®²¢¥²±²¢³¾-
¹³¾ ¯°®£° ¬¬³ ± ®¤®¢°¥¬¥®© § £°³§ª®© ¢ ¥¥ ° ±±¬ ²°¨¢ ¥¬®©
±¨±²¥¬».
³ª¶¨¿ ndcluster(¨¬¿ ´ ©« ) ®²ª°»¢ ¥² ¯°®£° ¬¬³ ª« ±²¥-
°¨§ ¶¨¨ ± ®¤®¢°¥¬¥®© § £°³§ª®© ³ª § ®£® ´ ©« ¤ »µ.
5.5.3. ¤ ¨¥ ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨. ¤ ³¾ £°³¯¯³
¢ª«¾·¥» 11 ´³ª¶¨©(¯® ·¨±«³ ´³ª¶¨© ¯°¨ ¤«¥¦®±²¨, ¨±¯®«¼-
§³¥¬»µ ¢ ¯ ª¥²¥ Fuzzy Logic).
1. ³ª¶¨¿ dsigmf.
¯¨±¼: y = dsigmf(x,[a1 c1 a2 c2])
¯ ¨ ± ¨ ¥. ¤ ¥²±¿ ´³ª¶¨¿ ¯°¨ ¤«¥¦®±²¨, ®¯°¥¤¥«¿¥-
¬ ¿ ª ª ° §®±²¼ ¤¢³µ ±¨£¬®¨¤ «¼»µ ´³ª¶¨©. ¨£¬®¨¤ «¼ ¿
´³ª¶¨¿, ª ª ¨§¢¥±²®, ®¯¨±»¢ ¥²±¿ ¢»° ¦¥¨¥¬
1
f (x; a; c) =
1 + exp ( ,a(x , c))
¨ § ¢¨±¨² ®² ¤¢³µ ·¨±«®¢»µ ¯ ° ¬¥²°®¢ a ¨ c. ¯¨±»¢ ¥¬ ¿ ´³ª-
¶¨¿, ª ª ®²¬¥·¥®, ¿¢«¿¥²±¿ ° §®±²¼¾ ¤¢³µ ±¨£¬®¨¤ «¼»µ:
f1 (x; a1 ; c1) , f2 (x; a2 ; c2);
¨ § ¢¨±¨² ®² ·¥²»°¥µ ¯ ° ¬¥²°®¢ a1 , c1, a2 , c2 (¢¥ª²®° ¯ ° ¬¥²°®¢
[a1 c1 a2 c2]).
°¨¬¥°
Á x = 0:0.1:10;
Á y = dsigmf(x,[5 2 5 7]);
Á plot(x,y)
Á xlabel(0 dsigmf, P = [5 2 5 7]0 )
2. ³ª¶¨¿ gauss2mf.
¯¨±¼: y = gauss2mf(x,[sig1 c1 sig2 c2])
¯ ¨ ± ¨ ¥. ¤ ¥²±¿ ´³ª¶¨¿ ¯°¨ ¤«¥¦®±²¨, ¿¢«¿¾¹ ¿±¿
° §®±²¼¾ ¤¢³µ £ ³±±®¢»µ ´³ª¶¨©, ®¯°¥¤¥«¿¥¬ ¿ ±®®²®¸¥¨¥¬
f (x; 1 ; c1 ; 2; c2) = exp (,(x , c1)2 =12) , exp (,(x , c2 )2=22)
190 «.5. ª¥² FUZZY LOGIC TOOLBOX
¨ § ¢¨±¿¹³¾ ®² ·¥²»°¥µ ¯ ° ¬¥²°®¢ (1, c1, 2 , c2) ¨«¨ ¢¥ª²®°
¯ ° ¬¥²°®¢ [sig1 c1 sig2 c2].
°¨¬¥°
Á x = 0:0.1:10;
Á y = gbellmf(x,[2 4 6]);
Á plot(x,y)
Á xlabel(0 gbellmf, P = [2 4 6]0 )
5. ³ª¶¨¿ pimf.
¯¨±¼: y = pimf(x,[a b c d])
¯ ¨ ± ¨ ¥. ¤ ¥²±¿ ² ª §»¢ ¥¬³¾ -®¡° § ¿ ´³ª¶¨¿
¯°¨ ¤«¥¦®±²¨, ¯®«³·¨¢¸ ¿ ±¢®¥ §¢ ¨¥ ¨§-§ ±¢®¥®¡° §®©
´®°¬». ³ª¶¨¿ ¢»·¨±«¿¥²±¿ ± ¨±¯®«¼§®¢ ¨¥¬ ±¯« © ¯¯°®ª-
±¨¬ ¶¨¨ ¯® ·¥²»°¥¬ ²®·ª ¬, § ¤ ¢ ¥¬»¬ ¢¥ª²®°®¬ ¯ ° ¬¥²°®¢.
° ¬¥²°» a ¨ d ®¯°¥¤¥«¿¾² ®±®¢ ¨¥ ª°¨¢®©, ¯ ° ¬¥²°» b ¨
c | ¯®«®¦¥¨¥ ¯«®±ª®© ¢¥°¸¨».
°¨¬¥°
Á x = 0:0.1:10;
Á y = pimf(x,[1 4 5 10]);
Á plot(x,y)
Á xlabel(0 pimf, P=[1 4 5 10]0 )
6. ³ª¶¨¿ psigmf.
¯¨±¼: y = psigmf(x,[a1 c1 a2 c2])
¯ ¨ ± ¨ ¥. ¤ ¥²±¿ ´³ª¶¨¿ ¯°¨ ¤«¥¦®±²¨, ®¯°¥¤¥«¿¥-
¬ ¿ ª ª ¯°®¨§¢¥¤¥¨¥ ¤¢³µ ±¨£¬®¨¤ «¼»µ ´³ª¶¨©
f1 (x; a1 ; c1) , f2 (x; a2 ; c2);
¨ § ¢¨±¿¹ ¿ ®² ·¥²»°¥µ ¯ ° ¬¥²°®¢ a1, c1 , a2 , c2 (¢¥ª²®° ¯ ° -
¬¥²°®¢ [a1 c1 a2 c2]).
°¨¬¥°
Á x = 0:0.1:10;
Á y = psigmf(x,[2 3 -5 8]);
Á plot(x,y)
Á xlabel(0 psigmf, P = [2 3 -5 8]0 )
194 «.5. ª¥² FUZZY LOGIC TOOLBOX
°¨¬¥°»
Á a = read s(0 tip0 );
Á showrule(a,1)
ans =
5.5. ¡®² ± Fuzzy Logic Toolbox ¢ °¥¦¨¬¥ ª®¬ ¤®© ±²°®ª¨ 203
1. If (±¥°¢¨± is ¯«®µ®©) or (¥¤ is ¯®¤£®°¥¢¸ ¿) then
(· ¥¢»¥ is ¬ «»¥) (1)
Á showrule(a,[3 1],0symbolic0)
ans =
3. (±¥°¢¨±==®²«¨·»©)j(¥¤ ==¯°¥¢®±µ®¤ ¿))
(· ¥¢»¥=¹¥¤°»¥) (1)
1. (±¥°¢¨±==¯«®µ®©)j(¥¤ ==¯®¤£®°¥¢¸ ¿))
(· ¥¢»¥=¬ «»¥) (1)
³ª¶¨¿ rmmf ¨±¯®«¼§³¥²±¿ ¤«¿ ³¤ «¥¨¿ ´³ª¶¨¨ ¯°¨ ¤-
«¥¦®±²¨ ¨§ ±®±² ¢ ±¨±²¥¬».
¯¨±¼:
¨¬¿ = rmmf(¨¬¿, varType ,varIndex, mf ,mfIndex)
0 0 0 0
°¨¬¥°
Á point n = 101; % ¤ ¨¥ ª®«¨·¥±²¢ ²®·¥ª ³¨¢¥°± «¼®£®
¬®¦¥±²¢
Á x = linspace(min x, max x, point n)0 ;
Á A = trapmf(x, [-10 -2 1 3]); % ° ¯¥¶¥¨¤ «¼ ¿ ´³ª¶¨¿
¯°¨ ¤«¥¦®±²¨ ¯®¤¬®¦¥±²¢ A
Á B= gaussmf(x, [2 5]); % ³±±®¢ ´³ª¶¨¿ ¯°¨ ¤«¥¦®±²¨
¯®¤¬®¦¥±²¢
5.5. ¡®² ± Fuzzy Logic Toolbox ¢ °¥¦¨¬¥ ª®¬ ¤®© ±²°®ª¨ 217
Á C1= fuzarith(x, A, B, 0 sum0);
Á subplot(2,1,1);
Á plot(x, A, 0 b- -0 , x, B, 0 m:0, x, C1, 0 c0 );
Á title(0 ¥·¥²ª ¿ ±³¬¬ A+B0 );
Á C2= fuzarith(x, A, B, 0 prod0 );
Á subplot(2,1,2);
Á plot(x, A, 0 b- -0 , x, B, 0 m:0, x, C2, 0 c0 );
Á title(0 ¥·¥²ª®¥ ¯°®¨§¢¥¤¥¨¥ A B0 );
ans =
0
3 2 gaussmf
0 0
linear
0 0 0
220 «.5. ª¥² FUZZY LOGIC TOOLBOX
5.6. ¡®² Fuzzy Logic ± ¡«®ª ¬¨ Simulink
¨±²¥¬» ¥·¥²ª®£® ¢»¢®¤ , ±®§¤ »¥ ²¥¬ ¨«¨ ¨»¬ ®¡° §®¬
± ¯®¬®¹¼¾ ¯ ª¥² Fuzzy Logic Toolbox, ¤®¯³±ª ¾² ¨²¥£° ¶¨¾ ±
¨±²°³¬¥² ¬¨ ¯ ª¥² Simulink, ·²® ¯®§¢®«¿¥² ¢»¯®«¿²¼ ¬®¤¥-
«¨°®¢ ¨¥ ±¨±²¥¬ ¢ ° ¬ª µ ¯®±«¥¤¥£®.
5.6.1. °¨¬¥°: ª®²°®«¼ ³°®¢¿ ¢®¤» ¢ ¡ ª¥. °¨±. 5.44 ¨§®-
¡° ¦¥ ®¡º¥ª² ³¯° ¢«¥¨¿ ¢ ¢¨¤¥ ¡ ª ± ¢®¤®©, ª ª®²®°®¬³ ¯®¤µ®-
¤¿² ¤¢¥ ²°³¡»: ·¥°¥§ ®¤³ ²°³¡³, ± ¡¦¥³¾ ª° ®¬, ¢®¤ ¢²¥ª ¥²
¢ ¡ ª, ·¥°¥§ ¤°³£³¾ | ¢»²¥ª ¥².
®¤ ·³ ¢®¤» ¢ ¡ ª ¬®¦® °¥£³«¨°®¢ ²¼, ¡®«¼¸¥ ¨«¨ ¬¥¼¸¥
®²ª°»¢ ¿ ª° . ±µ®¤ ¢®¤» ¿¢«¿¥²±¿ ¥ª®²°®«¨°³¥¬»¬ ¨ § ¢¨-
±¨² ®² ¤¨ ¬¥²° ¢»µ®¤®© ²°³¡» (® ´¨ª±¨°®¢ ) ¨ ®² ²¥ª³¹¥£®
¨±. 5.44. µ¥¬ ²¨·¥±ª®¥ ¯°¥¤±² ¢«¥¨¥ ®¡º¥ª² ³¯° ¢«¥¨¿ (¡ ª ± ¢®¤®©)
³°®¢¿ ¢®¤» ¢ ¡ ª¥. ±«¨ ¯®¨¬ ²¼ ¯®¤ ¢»µ®¤®© (°¥£³«¨°³¥-
¬®©) ¯¥°¥¬¥®© ³°®¢¥¼ ¢®¤», ¯®¤ °¥£³«¨°³¾¹¨¬ ½«¥¬¥²®¬ |
ª° , ²® ¬®¦® ®²¬¥²¨²¼, ·²® ¯®¤®¡»© ®¡º¥ª² °¥£³«¨°®¢ ¨¿, ±
²®·ª¨ §°¥¨¿ ¥£® ¬ ²¥¬ ²¨·¥±ª®£® ®¯¨± ¨¿, ¿¢«¿¥²±¿ ¤¨ ¬¨·¥-
±ª¨¬ ¨ ±³¹¥±²¢¥® ¥«¨¥©»¬.
¯°¥¤¥«¨¬ ¶¥«¼ ³¯° ¢«¥¨¿ §¤¥±¼ ª ª ³±² ®¢«¥¨¥ ³°®¢¿
¢®¤» ¢ ¡ ª¥ ²°¥¡³¥¬®¬ (¨§¬¥¿¾¹¥¬±¿) ³°®¢¥ ¨ ¯®¯°®¡³¥¬
°¥¸¨²¼ ±®®²¢¥²±²¢³¾¹³¾ § ¤ ·³ ³¯° ¢«¥¨¿ ±°¥¤±²¢ ¬¨ ¥·¥²ª®©
«®£¨ª¨.
·¥¢¨¤®, ¢ °¥£³«¿²®°, ®¡¥±¯¥·¨¢ ¾¹¨© ¤®±²¨¦¥¨¥ ¶¥«¨ ³¯° -
¢«¥¨¿, ¤®«¦ ¯®±²³¯ ²¼ ¨´®°¬ ¶¨¿ ® ¥±®®²¢¥²±²¢¨¨ (° §®-
±²¨) ²°¥¡³¥¬®£® ¨ ´ ª²¨·¥±ª®£® ³°®¢¥© ¢®¤», ¯°¨ ½²®¬ ¤ »©
5.6. ¡®² Fuzzy Logic ± ¡«®ª ¬¨ Simulink 221
°¥£³«¿²®° ¤®«¦¥ ¢»° ¡ ²»¢ ²¼ ³¯° ¢«¿¾¹¨© ±¨£ « °¥£³«¨-
°³¾¹¨© ½«¥¬¥² (ª° ).
¯¥°¢®¬ ¯°¨¡«¨¦¥¨¨ ´³ª¶¨®¨°®¢ ¨¥ °¥£³«¿²®° ¬®¦®
®¯¨± ²¼ ¡®°®¬ ¨§ ±«¥¤³¾¹¨µ ¯° ¢¨«:
1. If (level is okay) then (valve is no change) (1)
2. If(level is low) then (valve is open fast) (1)
3. If (level is high) then (valve is close fast) (1)
4. If (level is okay) and (rate is positive) then
(valve is close slow) (1)
5. If (level is okay and (rate is negative) then
(valve is open slow) (1),
·²® ¢ ¯¥°¥¢®¤¥ ®§ · ¥²:
1. ±«¨ (³°®¢¥¼ ±®®²¢¥²±²¢³¥² § ¤ ®¬³), ²® (ª° ¡¥§ ¨§¬¥-
¥¨¿) (1)
2. ±«¨ (³°®¢¥¼ ¨§ª¨©), ²® (ª° ¡»±²°® ®²ª°»²¼) (1)
3. ±«¨ (³°®¢¥¼ ¢»±®ª¨©), ²® (ª° ¡»±²°® § ª°»²¼) (1)
4. ±«¨ (³°®¢¥¼ ±®®²¢¥²±²¢³¥² § ¤ ®¬³) ¨ (¥£® ¯°¨°®±² |
¯®«®¦¨²¥«¼»©), ²® (ª° ¤® ¬¥¤«¥® § ª°»¢ ²¼) (1)
5. ±«¨ (³°®¢¥¼ ±®®²¢¥²±²¢³¥² § ¤ ®¬³) ¨ (¥£® ¯°¨°®±² |
®²°¨¶ ²¥«¼»©), ²® (ª° ¤® ¬¥¤«¥® ®²ª°»¢ ²¼) (1)