# Its Getting Fuzzy!

## Recommended Posts

Linguistic Variables - general variables with no specific value.

example: bright - a relative value to previous or current conditions; a bright candle, a bright reflection.

Overlapping Linguistic Variables - an associated condition to another variable.

example: the day is bright - what time of day and how bright;

the person is bright - is the person a doctor, enginneer, plumber?

- are they glowing, smart, or just wearing a headlamp?

There is also the case of Linguistic plus absolute/specific variable overlaps.

example: a very bright candle - the linguistic variable(very) + a reference to the candela value(bright)

(This example changed the type of variable “bright” was introduced as earlier.)

CODE EXAMPLE

```unsigned long bright; /* candela value of the light source */

unsigned char howBright(unsigned long candelaValue)
{
unsigned char apperentValue = 0;

if(howBright>1)
{
if(howBright>100000)
{
apperentValue = 0xFF; /* very bright */
}
else if(howBright>=50000)
.
.
.
}
else
{
apperentValue = 0; /* less than minimum brightness */
}
return apperentValue;
}```

Edited by emte

##### Share on other sites

As with all programming languages operators play a very special role.

Standard Operators

```#define _fuzzyOne    0xFF                    /* Fuzzy Logic One */
#define _fuzzyZero   0x00                   /* Fuzzy Logic Zero */
#define _fuzzyOR(x,y) ((x>y)?x:y)      /* Fuzzy Logic OR */
#define _fuzzyAND(x,y) ((x<y)?x:y)   /* Fuzzy Logic AND */
#define _fuzzyNOT(x) (_fuzzyOne-x) /* Fuzzy Logic NOT */```

##### Share on other sites

Fuzzy Logic Equations

(not to be confused with the actual programming code, this is for

mental accounting and visualization)

(Example is from:

Fuzzy Logic in Embedded Microcomputers and Control Systems

Page 17

By Walter Banks and Gordon Hayward)

```LINGUISTIC day TYPE void
{
MEMBER MUGGY  ( FUZZY ( Temperature IS HOT AND Humidity IS HUMID ))
MEMBER HOT        ( FUZZY Temperature IS HOT )
MEMBER HUMID    ( FUZZY Humidity IS HUMID )
MEMBER COLD      ( FUZZY Temperature IS COLD )
MEMBER CLAMMY ( FUZZY (Temperature IS COLD AND Humidity IS HUMID ))
}```

These equations outline the relationships between the fuzzy variables and

the absolute ones into the fuzzy output variable that you are interested in.

##### Share on other sites

Degree of Membership (DOM) is the term that refers to the specific

equation for a member of a fuzzy logic equation.

To continue from the previous post:

(Example is from:

Fuzzy Logic in Embedded Microcomputers and Control Systems

Page 17

By Walter Banks and Gordon Hayward)

One of the DOM:

```unsigned int day_MUGGY(unsigned int __CRISP)
{
return (f_and(Temperature_HOT(__CRISP), Humidity_HUMID(__CRISP)));
}```

"__CRISP" is the measurable/numeric value associated with these events.

"f_and" is the same _fuzzyAND(x,y) i defined earlier, just a different style/form.

This DOM equation is for the linguisitc variable "day", the rest of the variables

are numerically measurable values, that, in a certain combination are "MUGGY".

##### Share on other sites

Your content will need to be approved by a moderator

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoticons maximum are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.