Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
51 views

Fuzzy Logic Examples Using Matlab: Too Slow Just Right Too Fast

This document describes using fuzzy logic in Matlab to control the speed of a motor by adjusting the input voltage. It defines membership functions for input motor speed (too slow, just right, too fast) and output voltage (less, no change, more). Rules state that if speed is too slow, output more voltage, if just right, no change, and if too fast, output less voltage. For a test input speed above the set point, it calculates the required reduced output voltage using the fuzzy logic system in Matlab, matching the earlier hand calculation.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Fuzzy Logic Examples Using Matlab: Too Slow Just Right Too Fast

This document describes using fuzzy logic in Matlab to control the speed of a motor by adjusting the input voltage. It defines membership functions for input motor speed (too slow, just right, too fast) and output voltage (less, no change, more). Rules state that if speed is too slow, output more voltage, if just right, no change, and if too fast, output less voltage. For a test input speed above the set point, it calculates the required reduced output voltage using the fuzzy logic system in Matlab, matching the earlier hand calculation.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Fuzzy Logic Examples using Matlab

Consider a very simple example:


We need to control the speed of a motor by changing the input voltage. When a set
point is defined, if for some reason, the motor runs faster, we need to slow it down
by reducing the input voltage. If the motor slows below the set point, the input
voltage must be increased so that the motor speed reaches the set point.
Let the input status words be:
Too slow
Just right
Too fast
Let the output action words be:
Less voltage (Slow down)
No change
More voltage (Speed up)
Define the rule-base:
1. If the motor is running too slow, then more voltage.
2. If motor speed is about right, then no change.
3. If motor speed is to fast, then less voltage.
Define the membership functions for inputs and output variable as shown in figure
below.

Figure 1. Membership Functions

Suppose, the speed increases from the set point of 2420 to 2437.4 rpm. This is
depicted on the membership function as shown below.

Figure 2. Speed above set point

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.

Figure 3. Motor voltage

Now, area of Not much change triangle is 0.008 and area of Slow down triangle
is 0.012.
The output, as seen in Figure 3 (above), is determined by calculating the point at
which a fulcrum would balance the two triangles.
Thus,
0.008 X D1 = 0.012 X D2
D1 + D2 = 0.04

(1)
(2)

Solving (1) and (2) simultaneously we get,


D1=0.024
D2=0.016
Thus the voltage required would be 2.40-0.024=2.376 V

Lets solve this using Matlab.


Type fuzzy in the Matlab command prompt.
Draw the appropriate membership functions as shown below:

Figure 4. Input Membership Function

Figure 5. Output Membership Function

Now set the rules 1-3 as defined earlier.

Figure 6. Rule Base

Save the file as one.fis.


Now type in the following to get the result for the same example:
fis = readfis('one');
out=evalfis(2437.4,fis)
>>out = 2.376 (Same as above)

You might also like