Bab Vi Fuzzy Systems: Basics Using MATLAB Fuzzy Toolbox: Pendahuluan

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

BAB VI

FUZZY SYSTEMS:
Basics using MATLAB Fuzzy Toolbox

Pendahuluan

USING MATLAB Fuzzy Toolbox GUI

Contoh 1. Let the room temperature T be a fuzzy variable. Characterize it with three different
(fuzzy) temperatures: cold,warm, hot.

SOLUTION:
.
1.. First define the temperature range, e.g. [00, 400]

2. When MATLAB is open, then open GUI (GUI = Graphical User Interface) by typing fuzzy
Next activate input membership block by moving mouse on top of it and by clicking once.
Activation is shown by a red boundary on the block. If you click twice, the
MEMBERSHIP FUNCTION EDITOR opens up. This is needed when defining membership
functions.

Another way to do the same is to use View menu (cf. Figure below). Input block is again
activated first.
First change Range to the one given in the problem or to [00, 400 ]. This is done by moving the
cursor to the Range area and clicking once. Then you can correct the figures in the range domain
as you would correct text in a text document. Note that you have to leave space between the
numbers.

Next click Close or anywhere in the light grey area above with the mouse. The result is shown
below.
Now you are ready to define new membership functions. Choose Add MF's from EDIT menu.
The following display is shown.

Default value is three triangular (trimf) (3) membership functions as seen on the display. These
will divide the range into three equal parts.

Click OK, if you are happy with the default values, otherwise make your own choice. (Try e.g.
five gaussian membership functions. Different membership functions
can be found under MF type.)

The result is shown below. Note that the default names for the membership functions are mf1,
mf2 and mf3.
Contoh 2. car driving

You are driving car A on a highway. You want to keep a safe distance to car B in front of you.
Design a (simplified) fuzzy-logic system, which satisfies the requirements.

Proceed as follows:
a. Determine the required fuzzy variables (input/output) and their ranges.
b. Form the rule base.
c. Use fuzzy reasoning to check the operability of the rulebase.

SOLUTION:
a. Fuzzy variables. Start with a simple case.
INPUT: Distance d
OUTPUT: Breaking power b (gas pedal)
Three (3) membership functions are chosen for both input and output.
Membership functions for INPUT:
Distance d (meters): short, medium, long.
Membership functions for OUTPUT:
Breaking power b (%): large, medium, none

Give a name to the fuzzy input variable. Call it distance. Click


Close.

Next click the input block twice with mouse to open the membership function window. First
define the range, say from 0 to 30 m/s.
Next choose from Edit Add MFs. Pick the default values: 3 triangular membership functions.
Give a name to each: Call them high, medium, and short. When you are
finished, click Close.
Repeat the same procedure with the output b, breaking power.
Define the name of the output, break, and its range. Use three membership functions:
hard, medium and no. The following GUI display is obtained.

What is missing from the fuzzy system now is the rule base. Open View menu and click Edit
rules. Then the following display opens.
With mouse choose the membership function low for the distance and hard for brake. This is
done in the figure above. Then click Add rule. The result is seen below.
If distance is low, then brake is hard.

Viewing rules gives you the overall picture of the developed fuzzy system. From the main FIS
editor, choose from View menu View rules.
The display View rules is shown below.

Finally, the input-output mapping can be observed by viewing surface. Choose View menu and
under it View surface. It is clear that our map is nonlinear.
Tugas
1. Sistem kendali kecepatan motor DC dengan input dan output sebagai berikut:

• Dari penjelasan diatas dapat ditentukan ada 3 aturan pengendalian sebagai


berikut:
• Aturan #1:
• IF error IS negatif THEN teg IS kecil
• Aturan #2:
• IF error IS zero THEN teg IS sedang
• Aturan #3:
• IF error IS positif THEN teg IS besar

Diharapkan dengan aturan tersebut motor akan berputar dengan kecepatan yang stabil pada 260
rpm. Ketika kecepatan motor 285 rpm, dimana lebih besar dari kecepatan yang diinginkan yaitu
260 rpm, berapakah tegangan yang dikeluarkan kontroler agar motor berputar pada kecepatan
normalnya (260 rpm)?
2. Sistem kontrol dibawah ini dengan input : suhu udara (0C) dan kelembaban tanah (%).Output
: waktu penyiraman (menit),

Cold Cool normal Warm Hot


1

-10 0 3 12 15 24 27 36 39 50 Suhu (0C)


Dry Moist Wet
1 Short Medium Long
1

0 10 20 40 50 70 Kelembaban (0C) 0 20 28 40 48 90 Waktu penyiraman (menit)

short medium long

0 20 40 60

Durasi penyiraman

Tentukan lamanya waktu penyiraman dengan model mamdani dan sugeno untuk suhu 340C
dengan kelembaban tanah 15 % . Aturan fuzzy untuk sistem kontrol penyiraman air

suhu cold cool normal warm hot

kelembaban
Dry Long long Long Long Long
Moist Long Medium Medium Medium Medium

wet short Short short short short

3. Sistem kontrol pendulum berdasarkan blok diagram dibawah


d+L/2
Subtract1 J.s2 +c.s+m*g*d 180/pi
Scope3
du/dt
Fuzzy Logic Transfer Fcn1 Gain
Derivative Controller

Step1

Input kontroler terdiri dari : error dan Delta error

Output thrust

• Rule Base
– IF (error is -tive) AND (errorDer is dec) THEN (thrust is low)
– IF (error is -tive) AND (errorDer is stat) THEN (thrust is low)
– IF (error is -tive) AND (errorDer is inc) THEN (thrust is nominal)
– IF (error is zero) AND (errorDer is dec) THEN (thrust is low)
– IF (error is zero) AND (errorDer is stat) THEN (thrust is nominal)
– IF (error is zero) AND (errorDer is inc) THEN (thrust is high)
– IF (error is +tive) AND (errorDer is dec) THEN (thrust is nominal)
– IF (error is +tive) AND (errorDer is stat) THEN (thrust is high)
– IF (error is +tive) AND (errorDer is inc) THEN (thrust is high)

Pertanyaan : jika error = -450 , delta error =O0

a. Tentukan besarnya daya dorong (thrust )yang harus diberikan untuk mengerakan
pendulum.
b. Plot respon step sistem menggunakan simulink , persamaan plant pendulum sbb;
 (s) 1.89
 2
T ( s ) s  3.89 s  .7.7
4. Fuzzy logic digunakan untuk mengontrol kecepatan motor DC . Input dari fuzzy terdiri dari
error (E) dan perubahan error (dE). Sedangkan outputnya tegangan (V) untuk menggerakkan
motor.
Variabel linguistik error (E) dan delta eror (dE) terdiri dari : Negative (N), Positif (P)

   0 , x  20 
 20  x   x  (20) 
 N ( x)   , - 20  x  20   P ( x)   , - 20  x  20 
 40   40 
 0, x  20   1, x  20 
Variabel linguistik tegangan (V) terdiri dari, Negative (N), Zero (Z), Positif (P)

 0   0 ,x3 
 3 x   x3 
 N ( x)   , 0x3   P ( x)   , 3 x 5 
 3   2 
0, x3  1, x5 

  Variabel linguistik output tegangan diskrit


 0 , x  1 atau x  5  terdiri dari:
 x 1 
 Z ( x)   , 1 x  3  No. output Variabel
 2  (tegangan V) Fuzzy
5  x , 3 x 5 
 2  1 1 N
2 3 Z
3 5 P

Rule-rule yang digunakan sesuai dengan tabel


berikut:

a. Gambarkan membership function(fungsi keanggotaan )


E N P untuk input dan output!
b. Jika kecepatan referensi yang diberikan sebesar 1000
dE rpm ,sedangkan kecepatan aktual yang diterima sensor
N N Z kecepatan sebesar 985 rpm dan perubahan error = 0 ,
tentukan besarnya tegangan untuk mengerakkan motor
P Z P DC mengunakan model mamdani dan sugeno!

You might also like