Secondly, numbers to be fuzzified need to have a definite range. Membership
functions such as you have drawn, with a vertical line on the left, are used to
get membership values at the lower end of the allowable range. In other words,
if your x value is less than 0, you may have an error condition. Usually a
membership value of 1 or an error is returned if x is less than zero.
>From the book I've been reading there is example source code for the
>function:
>
>if (speed >=0 && speed <=0)
> result=100;
>else if (speed >=0 && speed <=5)
> result=100 - (((speed - (0))*200)/10);
>
I have no idea what book you are reading, but that code is pretty silly. No
matter what the value of speed is, "speed <= 0 AND speed >= 0" will always be
false unless x is 0; that code is precisely equivalent to "speed == 0". It does
look like result is a membership, with the max membership being 100 instead of
1 so you can use integers. Assuming that this is the case, then better code
would be
if (speed <= 0) then result = 100
else if (speed >= 0 and speed < 5) then result = 100 - (speed * 100) / 5
else if (speed >= 5 then result = 0
This code would yield these values:
speed result (equivalent membership)
-5 100 1
0 100 1
2 60 0.6
4 20 0.2
5 0 0
As another responder has pointed out, the restriction to inetegers means that
you would have to use a multiplication factor for speed to give you decent
resolution. So say that a speed value of 1 (externally) woul be represented by
100 internally. Then you might have this code:
if (speed <= 0) then result = 100
else if (speed >= 0 and speed < 500) then result = 100 - (speed * 100) / 500
else if (speed >= 500 then result = 0
external internal result (membership)
0 0 100 1
2.5 250 50 0.5
5 500 0 0
I'm not sure what language you are using, so the above would have to be
slightly modified to fit yourlanguage's syntax.
William Siler
############################################################################
This message was posted through the fuzzy mailing list.
(1) To subscribe to this mailing list, send a message body of
"SUB FUZZY-MAIL myFirstName mySurname" to listproc@dbai.tuwien.ac.at
(2) To unsubscribe from this mailing list, send a message body of
"UNSUB FUZZY-MAIL" or "UNSUB FUZZY-MAIL yoursubscription@email.address.com"
to listproc@dbai.tuwien.ac.at
(3) To reach the human who maintains the list, send mail to
fuzzy-owner@dbai.tuwien.ac.at
(4) WWW access and other information on Fuzzy Sets and Logic see
http://www.dbai.tuwien.ac.at/ftp/mlowner/fuzzy-mail.info
(5) WWW archive: http://www.dbai.tuwien.ac.at/marchives/fuzzy-mail/index.html