стр. 61 |

additional parameter is the shape of the membership function; piecewise linear,

piecewise quadratic, or normally distributed (Gaussian). (In the case of normal

functions, the п¬Ѓrst and last parameters are the point at which the membership func-

tion reaches 0.5.)

Membership functions are displayed by the drawmemf command. Figure 10.1

shows a typical membership function plot.

TEAM LinG - Live, Informative, Non-cost and Genuine !

174 SIMPLE EXAMPLE PROGRAMS

Figure 10.1 Output of drawmemf command to display membership functions.

The example program drawmemf.fps illustrates the use of the drawmemf

command.

:******************************************************

:DRAWMEMF.FPS - illustrates drawmemf command

:******************************************************

message "Program DRAWMEMF.FPS to illustrate the drawmemf

command.";

:Specifications for the individual functions are given in the

:memfunct command. The first number is the point where the

:function first begins to rise from zero; the second number is

:the point where the function reaches 1000. The third number is

:the point where the function begins to decline from 1000; the

:fourth number is the point where it reaches zero again.

:If the first number is -1e6, the function starts at 1000 for

all

:values less than the third number, where it begins to decline

:toward zero; the only effect of the second number is to tell

:drawmemf where to start its plot.

:Similarly, if the fourth number is 1e6, the function never

:declines toward zero after its initial rise to 1000 at the value

:given by the second number; the only effect of the third number

:is to tell drawmemf where to stop its plot.

message "First membership functions are linear." ;

TEAM LinG - Live, Informative, Non-cost and Genuine !

175

10.6 MEMBERSHIP FUNCTIONS, FUZZIFICATION AND DEFUZZIFICATION

declare Data size fzset (SMALL MEDIUM LARGE);

memfunct Data size linear

SMALL -1e6 0 2 4

MEDIUM 2 4 4 8

LARGE 4 8 10 1e6 ;

drawmemf Data size;

message "Next membership functions are s-shape." ;

memfunct Data size s-shape

SMALL -1e6 0 2 4

MEDIUM 2 4 4 8

LARGE 4 8 10 1e6 ;

drawmemf Data size;

message "Last membership functions are normal.";

memfunct Data size normal

SMALL -1e6 0 2 4

MEDIUM 2 4 4 8

LARGE 4 8 10 1e6 ;

drawmemf Data size;

message "DRAWMEMF.FPS finished." ;

:exit ;

*******************************************************

10.6.2 Fuzzifying Numbers in FLOPS

Fortunately, there is only one generally accepted way of fuzzifying a number. As we

have shown, fuzzifying takes place as shown in Figure 10.2.

The FLOPS command fuzzify is used to fuzzify a number into grades of mem-

bership of a discrete fuzzy set. (A fuzzy set whose members describe a number is

called a linguistic variable.)

Program fuzzify.par illustrates the use of the fuzzify command.

:******************************************************

:program FUZZIFY.PAR - fuzzifies

:******************************************************

thresh 1;

declare Data x flt size fzset (small medium large);

TEAM LinG - Live, Informative, Non-cost and Genuine !

176 SIMPLE EXAMPLE PROGRAMS

Fuzzifying 2.5; Small 0.25, Medium 0.75, Large 0.

Figure 10.2

memfunct Data size normal

small -1e6 1 2

medium 1 2 2 3

large 2 3 1e6;

:rule r0

rule (goal Fuzzifies x into fuzzy set size)

IF (in Data x = <X> AND x <= 3.5)

THEN

message вЂ™Fuzzifying <X>\nвЂ™,

fuzzify 1 size <X>,

fire block 0 off,

fire block 1 on;

:Permit firing rules with zero confidence in fuzzy set

member

TestFsetOff;

rule block 1 (goal Prints out results of fuzzification)

IF (in Data x = <X> AND size.small = <S> AND size.medium = <M>

AND size.large = <L>)

THEN

message вЂ™<X> fuzzified: small <S> medium <M> large

<L>\nвЂ™,

reset,

in 1 x = (<X> + 0.5),

fire block 1 off,

fire block 0 on;

TEAM LinG - Live, Informative, Non-cost and Genuine !

177

10.6 MEMBERSHIP FUNCTIONS, FUZZIFICATION AND DEFUZZIFICATION

стр. 61 |