You are on page 1of 14

Fuzzy logic

Fuzzy logic is an approach to computing based on "degrees of truth" rather than the usual "true or false" (1 or 0) Boolean logic on which the modern computer is based. The idea of fuzzy logic was first advanced by Dr. Lotfi Zadeh of the University of California at Berkeley in the 1960s. Dr. Zadeh was working on the problem of computer understanding of natural language. Natural language (like most other activities in life and indeed the universe) is not easily translated into the absolute terms of 0 and 1. (Whether everything is ultimately describable in binary terms is a philosophical question worth pursuing, but in practice much data we might want to feed a computer is in some state in between and so, frequently, are the results of computing.)

Fuzzy logic includes 0 and 1 as extreme cases of truth (or "the state of matters" or "fact") but also includes the various states of truth in between so that, for example, the result of a comparison between two things could be not "tall" or "short" but ".38 of tallness." Fuzzy logic seems closer to the way our brains work. We aggregate data and form a number of partial truths which we aggregate further into higher truths which in turn, when certain thresholds are exceeded, cause certain further results such as motor reaction. A similar kind of process is used in artificial computer neural network and expert systems. It may help to see fuzzy logic as the way reasoning really works and binary or Boolean logic is simply a special case of it.

The fuzzy set concept

The difference between crisp (i.e., classical) and fuzzy sets is established by introducing a membership function. Consider a finite set X = {x1, x2, . . . , xn} which will be considered the universal set in what follows. The subset A of X consisting of the single element x1 can be described by the n-dimensional membership vector Z(A) = (1, 0, 0, . . . , 0), where the convention has been adopted that a 1 at the i-th position indicates that xi belongs to A. The set B composed of the elements x1 and xn is described by the vector Z(B) = (1, 0, 0, ..., 1). Any other crisp subset of X can be represented in the same way by an n-dimensional binary vector. But what happens if we lift the restriction to binary vectors? In that case we can define the fuzzy set C with the following vector description: Z(C) = (0.5, 0, 0, ..., 0)

In classical set theory such a set cannot be defined. An element belongs to a subset or it does not. In the theory of fuzzy sets we make a generalization and allow descriptions of this type. In our example the element x1 belongs to the set C only to some extent. The degree of membership is expressed by a real number in the interval [0, 1], in this case 0.5. This interpretation of the degree of membership is similar to the meaning we assign to statements such as person x1 is an adult. Obviously, it is not possible to define a definite age which represents the absolute threshold to enter into adulthood. The act of becoming mature can be interpreted as a continuous process in which the membership of a person to the set of adults goes slowly from 0 to 1.

Fuzzy Sets And Crisp Sets

The very basic notion of fuzzy systems is a fuzzy (sub)set. In classical mathematics we are familiar with what we call crisp sets. For example, the possible interferometric coherence g values are the set X of all real numbers between 0 and 1. From this set X a subset A can be defined, (e.g. all values 0 _g _ 0.2). The characteristic function of A, (i.e. this function assigns a number 1 or 0 to each element in X, depending on whether the element is in the subset A or not) is shown in Fig.1. The elements which have been assigned the number 1 can be interpreted as the elements that are in the set A and the elements which have assigned the number 0 as the elements that are not in the set

0 0.2 0.5 Figure 1: Characteristic Function of a Crisp Set

This concept is sufficient for many areas of applications, but it can easily be seen, that it lacks in flexibility for some applications like classification of remotely sensed data analysis. For example it is well known that water shows low interferometric coherence g in SAR images. Since g starts at 0, the lower range of this set ought to be clear. The upper range, on the other hand, is rather hard to define. As a first attempt, we set the upper range to 0.2. Therefore we get B as a crisp interval B=[0,0.2]. But this means that a g value of 0.20 is low but a g value of 0.21 not. Obviously, this is a structural problem, for if we moved the

upper boundary of the range from g =0.20 to an arbitrary point we can pose the same question. A more natural way to construct the set B would be to relax the strict separation between low and not low. This can be done by allowing not only the (crisp) decision Yes/No, but more flexible rules like fairly low. A fuzzy set allows us to define such a notion. The aim is to use fuzzy sets in order to make computers more intelligent, therefore, the idea above has to be coded more fo rmally. In the example, all the elements were coded with 0 or 1. A straight way to generalize this concept, is to allow more values between 0 and 1. In fact, infinitely many alternatives can be allowed between the boundaries 0 and 1, namely the unit interval I = [0, 1]. The interpretation of the numbers, now assigned to all elements is much more difficult. Of course, again the number 1 assigned to an element means, that the element is in the set B and 0 means that the element is definitely not in the set B. All other values mean a gradual membership to the set B.

Example for application of fuzzy logic Application of Fuzzy Logic to Approximate Reasoning Using Linguistic Synthesis. This paper describes an application of fuzzy logic in designing controllers for

industrial plants. A fuzzy logic is used to synthesize linguistic control protocol of a skilled operator. The method has been applied to pilot scale plants as well as in practical situations. The merits of this method and its usefulness to control engineering are discussed. An avenue for further work in this area is described where the need is to go beyond a purely descriptive approach, and means for implementing a prescriptive or a self-organizing system are explored. In recent years, the number and variety of applications of fuzzy logic have increased significantly. The applications range from consumer products such as cameras, camcorders, washing machines, and microwave ovens to industrial process control, medical instrumentation, decision-support systems, and portfolio selection. To understand why use of fuzzy logic has grown, you must first understand what is meant by fuzzy logic. Fuzzy logic has two different meanings. In a narrow sense, fuzzy logic is a logical system, which is an extension of multivalued logic. However, in a wider sense fuzzy logic (FL) is almost synonymous with the theory of fuzzy sets, a theory which relates to classes of objects with unsharp boundaries in which membership is a matter of degree. In this perspective, fuzzy logic in its narrow sense is a branch of FL. Even in its more narrow definition, fuzzy logic differs both in concept and substance from traditional multivalued logical systems. In Fuzzy Logic Toolbox software, fuzzy logic should be interpreted as FL, that is, fuzzy logic in its wide sense. The basic ideas underlying FL are explained very clearly and insightfully in Foundations of Fuzzy Logic. What might be added is that the basic concept

underlying FL is that of a linguistic variable, that is, a variable whose values are words rather than numbers. In effect, much of FL may be viewed as a methodology for computing with words rather than numbers. Although words are inherently less precise than numbers, their use is closer to human intuition. Furthermore, computing with words exploits the tolerance for imprecision and thereby lowers the cost of solution. Anotherr basic concept in FL, which plays a central role in most of its applications, is that of a fuzzy if-then rule or, simply, fuzzy rule. Although rule-based systems have a long history of use in Artificial Intelligence (AI), what is missing in such systems is a mechanism for dealing with fuzzy consequents and fuzzy antecedents. In fuzzy logic, this mechanism is provided by the calculus of fuzzy rules. The calculus of fuzzy rules serves as a basis for what might be called the Fuzzy Dependency and Command Language (FDCL). Although FDCL is not used explicitly in the toolbox, it is effectively one of its principal constituents. In most of the applications of fuzzy logic, a fuzzy logic solution is, in reality, a translation of a human solution into FDCL. A trend that is growing in visibility relates to the use of fuzzy logic in combination with neurocomputing and genetic algorithms. More generally, fuzzy logic, neurocomputing, and genetic algorithms may be viewed as the principal constituents of what might be called soft computing. Unlike the traditional, hard computing, soft computing accommodates the imprecision of the real world. The guiding principle of soft computing is: Exploit the tolerance for imprecision, uncertainty, and partial truth to achieve tractability, robustness, and low solution cost. In the future, soft computing could play an increasingly important role in the conception and design of systems whose MIQ (Machine IQ) is much higher than that of systems designed by conventional methods. Among various combinations of methodologies in soft computing, the one that has highest visibility at this juncture is that of fuzzy logic and neurocomputing, leading to neuro-fuzzy systems. Within fuzzy logic, such systems play a particularly important role in the induction of rules from observations. An effective method developed by Dr. Roger Jang for this purpose is called ANFIS (Adaptive Neuro-Fuzzy Inference System). This method is an important component of the toolbox. Fuzzy logic is all about the relative importance of precision: How important is it to be exactly right when a rough answer will do? You can use Fuzzy Logic Toolbox software with MATLAB technical computing software as a tool for solving problems with fuzzy logic. Fuzzy logic is a fascinating area of research because it does a good job of trading off between significance and precisionsomething that humans have been managing for a very long time. In this sense, fuzzy logic is both old and new because, although the modern and methodical science of fuzzy logic is still young, the concepts of fuzzy logic relies on age-old skills of human reasoning.

Fuzzy logic is a convenient way to map an input space to an output space. Mapping input to output is the starting point for everything. Consider the following examples:

With information about how good your service was at a restaurant, a fuzzy logic system can tell you what the tip should be. With your specification of how hot you want the water, a fuzzy logic system can adjust the faucet valve to the right setting. With information about how far away the subject of your photograph is, a fuzzy logic system can focus the lens for you. With information about how fast the car is going and how hard the motor is working, a fuzzy logic system can shift gears for you. A graphical example of an input-output map is shown in the following figure.

To determine the appropriate amount of tip requires mapping inputs to the appropriate outputs. Between the input and the output, the preceding figure shows a black box that can contain any number of things: fuzzy systems, linear systems, expert systems, neural networks, differential equations, interpolated multidimensional lookup tables, or even a spiritual advisor, just to name a few of the possible options. Clearly the list could go on and on. Of the dozens of ways to make the black box work, it turns out that fuzzy is often the very best way. Why should that be? As Lotfi Zadeh, who is considered to be the father of fuzzy logic, once remarked: "In almost every case you can build the same product without fuzzy logic, but fuzzy is faster and cheaper."

Temporal Logic Temporal logic controls execution of a chart in terms of time. In state actions and transitions, you can use two types of temporal logic: event-based and absolute-time. Eventbased temporal logic keeps track of recurring events, and absolute-time temporal logic defines time periods based on the simulation time of your chart. To operate on these recurring events or simulation time, you use built-in functions called temporal logic operators. - Rules for Using Temporal Logic Operators These rules apply to the use of temporal logic operators: You can use any explicit or implicit event as a base event for a temporal operator. A base event is a recurring event on which a temporal operator operates. For a chart with no input events, you can use the tick or wakeup event to denote the implicit event of a chart waking up. Temporal logic operators can appear only in: State actions Transitions that originate from states Transition segments that originate from junctions when the full transition path connects two states Note: This restriction means that you cannot use temporal logic operators in default transitions or flow chart transitions.

o o o

Every temporal logic operator has an associated state: the state in which the action appears or from which the transition originates. You must use event notation (see Notations for Event-Based Temporal Logic) to express event-based temporal logic in state actions.

Operators for Event-Based Temporal Logic For event-based temporal logic, use the operators as described below. Operator after Syntax after(n, E) where E is the base event for the after operator and n is one of the following: A positive integer An expression that evaluates to a positive integer value Description Returns true if the base event E has occurred at least n times since activation of the associated state. Otherwise, the operator returns false. In a chart with no input events, after(n, tick)or after(n, wakeup) returns true if the chart has woken up n times or more since activation of the associated state. Resets the counter for E to 0 each time the associated state reactivates.

before

before(n, E) Returns true if the base event E has where E is the base event for occurred fewer than n times since the before operator and n is one activation of the associated state. of the following: Otherwise, the operator returns false. A positive integer In a chart with no input events, before(n,

Operator

Syntax

Description

An expression that evaluates to a tick)or before(n, wakeup) returns true if positive integer value the chart has woken up fewer than n times since activation of the associated state. Resets the counter for E to 0 each time the associated state reactivates. at(n, E) where E is the base event for the at operator andn is one of the following: A positive integer An expression that evaluates to a positive integer value Returns true only at the nth occurrence of the base event E since activation of the associated state. Otherwise, the operator returns false. In a chart with no input events, at(n, tick) orat(n, wakeup) returns true if the chart has woken up for the nth time since activation of the associated state. Resets the counter for E to 0 each time the associated state reactivates. Returns true at every nth occurrence of the base event E since activation of the associated state. Otherwise, the operator returns false. In a chart with no input events, every(n, tick)or every(n, wakeup) returns true if the chart has woken up an integer multiple n times since activation of the associated state. Resets the counter for E to 0 each time the associated state reactivates. Therefore, this operator is useful only in state actions and not in transitions.

at

every

every(n, E) where E is the base event for the every operator and n is one of the following: A positive integer An expression that evaluates to a positive integer value

temporalCount temporalCount(E) Increments by 1 and returns a positive where E is the base event for integer value for each occurrence of the the temporalCountoperator. base event E that takes place after activation of the associated state. Otherwise, the operator returns a value of 0. Resets the counter for E to 0 each time the associated state reactivates. Examples of Event-Based Temporal Logic These examples illustrate usage of event-based temporal logic in state actions and transitions. Operator after Usage State Example on after(5, Description CLK): A status message appears during

Operator

Usage action (on after)

Example status('on');

Description each CLK cycle, starting 5 clock cycles after activation of the state.

after

Transition ROTATE[after(10, CLK)] A transition out of the associated state occurs only on broadcast of a ROTATEevent, but no sooner than 10CLK cycles after activation of the state. State action (on before) on before(MAX, CLK): The temp variable increments once temp++; per CLK cycle until the state reaches the MAX limit.

before

before

Transition ROTATE[before(10, CLK)]

A transition out of the associated state occurs only on broadcast of a ROTATEevent, but no later than 10 CLKcycles after activation of the state.

at

State action (on at)

on at(10, status('on');

CLK): A status message appears at exactly 10 CLK cycles after activation of the state. A transition out of the associated state occurs only on broadcast of a ROTATEevent, at exactly 10 CLK cycles after activation of the state.

at

Transition ROTATE[at(10, CLK)]

every

State action (on every)

on every(5, status('on');

CLK): A status message appears every 5 CLK cycles after activation of the state.

temporalCount State action (during)

du: y = This action counts and returns the mm[temporalCount(tick)]; integer number of ticks that have elapsed since activation of the state. Then, the action assigns to the variable y the value of the mm array whose index is the value that thetemporalCount operator returns.

Notations for Event-Based Temporal Logic You can use one of two notations to express event-based temporal logic.

Event Notation Use event notation to define a state action or a transition condition that depends only on a base event. Event notation follows this syntax: tlo(n, E)[C] where

tlo is a Boolean temporal logic operator (after, before, at, or every) n is the occurrence count of the operator E is the base event of the operator C is an optional condition expression

Conditional Notation Use conditional notation to define a transition condition that depends on base and nonbase events. Conditional notation follows this syntax: E1[tlo(n, E2) && C] where

E1 is any nonbase event tlo is a Boolean temporal logic operator (after, before, at, or every) n is the occurrence count of the operator E2 is the base event of the operator C is an optional condition expression Define Time Delays with Temporal Logic Use one of the keywords sec , msec, or usec to define simulation time in seconds, milliseconds, or microseconds that have elapsed since activation of a state. These keywords are valid only in state actions and in transitions that originate from states. Example of Defining Time Delays The following continuous-time chart defines two absolute time delays in transitions.

Chart execution occurs as follows: 1. 2. 3. 4. 5. 6. When the chart awakens, the state Input activates first. After 5.33 milliseconds of simulation time, the transition from Input to Output occurs. The state Input deactivates, and then the state Output activates. After 10.5 seconds of simulation time, the transition from Output to Input occurs. The state Output deactivates, and then the state Input activates. Steps 2 through 5 are repeated, until the simulation ends.

Example of Detecting Elapsed Time In the following model, the Step block provides a unit step input to the chart.

The chart determines when the input u equals 1.

If the input equals 1... Before t = 2 Between t = 2 and t = 5 After t = 5

A transition occurs from... Start to Fast Start to Good Start to Slow

Advantages of Using Absolute-Time Temporal Logic for Delays


Use absolute-time temporal logic instead of the implicit tick event for these reasons: Delay expressions that use absolute-time temporal logic are independent of the sample time of the model. However, the tick event is dependent on sample time. Absolute-time temporal logic works in charts that have function-call input events. The tick event does not work in charts with function-call inputs. Absolute-time temporal logic supports seconds (sec), milliseconds (msec) and microseconds (usec) syntax for the before and afteroperators.

Examples of Absolute-Time Temporal Logic These examples illustrate absolute-time temporal logic in state actions and transitions. Operator Usage after State action (on after) after Example Description

on after(12.3, After 12.3 seconds of simulation time since sec): temp = activation of the state, tempvariable LOW; becomes LOW . After 8 milliseconds of simulation time have passed since activation of the state, a transition out of the associated state occurs. After 5 microseconds of simulation time have passed since activation of the state, a transition out of the associated state occurs.

Transition after(8, msec)

after

Transition after(5, usec)

before

Transition [temp > 75 && If the variable temp exceeds 75 and fewer than before(12.34, 12.34 seconds have elapsed since activation of the sec)] state, a transition out of the associated state occurs.

Best Practices for Absolute-Time Temporal Logic Use the after Operator to Replace the at Operator If you use the at operator with absolute-time temporal logic, an error message appears when you try to simulate your model. Use theafter operator instead. Suppose that you want to define a time delay using the transition at(5.33, sec).

Change the transition to after(5.33, sec), as shown below.

Use an Outer Self-Loop Transition with the after Operator to Replace the every Operator If you use the every operator with absolute-time temporal logic, an error message appears when you try to simulate your model. Use an outer self-loop transition with the after operator instead.

Suppose that you want to print a status message for an active state every 2.5 seconds during chart execution, as shown in the state action of Check_status.

Replace the state action with an outer self-loop transition, as shown below.

You must also add a history junction in the state so that the chart remembers the state settings prior to each self-loop transition. (SeeRecord State Activity Using History Junctions.)

Directory book
http://www.mathworks.com/help/stateflow/ug/using-temporal-logic-in-state-actionsand-transitions.html#brh91yy-9_2

http://www.mathworks.com/help/fuzzy/what-is-fuzzy-logic.html

http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=1674779&url=http://ieeexplo re.ieee.org/xpls/abs_all.jsp%3Farnumber%3D1674779

A. Montanari. Metric and Layered Temporal Logic for Time Granularity.PhD thesis, Institute for Logic, Language and Computation,University of Amsterdam, 1996.

TASK SET AND LOGIC Fuzzy Logic and Temporal Logic

Completed By : Name NRI Class : Christian E. Y. Koba : 13101103010 : Mathematic

FACULTY OF MATHEMATICS AND NATURAL SCIENCE UNIVERSITY OF SAM RATULANGI MANADO 2013

You might also like