Fuzzy Logic Examples Using Matlab PDF
Fuzzy Logic Examples Using Matlab PDF
Too slow
Just right
Too fast
Define the membership functions for inputs and output variable as shown in figure below.
0.4
0.3
The intersection points would be 0.4 and 0.3. From figure 1, we see that this speed
would only intersect the rectangles consisting of rules 2 and 3. We now change the height
of the triangles for input voltage.
Thus,
D1=0.024
D2=0.016
Thus the voltage required would be 2.40-0.024=2.376 V
Lets solve this using Matlab.
fis = readfis('one');
out=evalfis(2437.4,fis)
>>out =
Consider the next example with two inputs and one output.
Let the inputs be angle and angular velocity and the controller output be the force on the
mass.
Now, define the rule base as:
Consider a scenario:
Let the measured angle and velocity be as shown in the figure above.
We see that this will fire 4 rules:
1. If angle is zero and velocity is zero then force is zero
2. If angle is zero and velocity is NL then force is NL
3. If angle is PL and velocity is zero then force is PL
4. If angle is PL anfd velocity is NL then force is zero
We will solve this using Matlab. Define the inputs and output similar to example 1.
fis = readfis('two');
out=evalfis([65 -0.1],fis)
>>out =