# 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)

it is not possible to define a definite age which represents the absolute threshold to enter into adulthood. For example it is well known that water shows low interferometric coherence g in SAR images. But this means that a g value of 0. Since g starts at 0. this is a structural problem. (i.20 is low but a g value of 0. Therefore we get B as a crisp interval B=[0.0. in this case 0. This interpretation of the degree of membership is similar to the meaning we assign to statements such as “person x1 is an adult”. is rather hard to define. - Fuzzy Sets And Crisp Sets The very basic notion of fuzzy systems is a fuzzy (sub)set. In the theory of fuzzy sets we make a generalization and allow descriptions of this type.2 0. In classical mathematics we are familiar with what we call crisp sets. An element belongs to a subset or it does not. the possible interferometric coherence g values are the set X of all real numbers between 0 and 1. 1].2. the lower range of this set ought to be clear. Obviously.In classical set theory such a set cannot be defined.5. As a first attempt. (e. In our example the element x1 belongs to the set C only to some extent. for if we moved the . we set the upper range to 0.21 not. The characteristic function of A. The degree of membership is expressed by a real number in the interval [0.2]. but it can easily be seen. From this set X a subset A can be defined.g. 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 1 0 0. on the other hand. depending on whether the element is in the subset A or not) is shown in Fig. this function assigns a number 1 or 0 to each element in X.5 Figure 1: Characteristic Function of a Crisp Set 1 This concept is sufficient for many areas of applications.1. all values 0 _g _ 0. that it lacks in flexibility for some applications like classification of remotely sensed data analysis. 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. The upper range.e.2). For example. Obviously.

decision-support systems. washing machines. namely the unit interval I = [0. a theory which relates to classes of objects with unsharp boundaries in which membership is a matter of degree. The applications range from consumer products such as cameras. This paper describes an application of fuzzy logic in designing controllers for industrial plants.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. camcorders. fuzzy logic should be interpreted as FL. To understand why use of fuzzy logic has grown. and portfolio selection. In this perspective. you must first understand what is meant by fuzzy logic.upper boundary of the range from g =0. but more flexible rules like ” fairly low”. and microwave ovens to industrial process control. is to allow more values between 0 and 1. that the element is in the set B and 0 means that the element is definitely not in the set B. An avenue for further work in this area is described where the need is to go beyond a purely descriptive approach. medical instrumentation. in a wider sense fuzzy logic (FL) is almost synonymous with the theory of fuzzy sets. A fuzzy set allows us to define such a notion. the number and variety of applications of fuzzy logic have increased significantly. The aim is to use fuzzy sets in order to make computers more ’intelligent’. The method has been applied to pilot scale plants as well as in practical situations. again the number 1 assigned to an element means. In Fuzzy Logic Toolbox™ software. therefore. However. What might be added is that the basic concept . that is. All other values mean a gradual membership to the set B. the idea above has to be coded more fo rmally. A fuzzy logic is used to synthesize linguistic control protocol of a skilled operator. Of course. and means for implementing a prescriptive or a self-organizing system are explored. The basic ideas underlying FL are explained very clearly and insightfully in Foundations of Fuzzy Logic. Even in its more narrow definition. - Example for application of fuzzy logic Application of Fuzzy Logic to Approximate Reasoning Using Linguistic Synthesis. now assigned to all elements is much more difficult. fuzzy logic in its wide sense. Fuzzy logic has two different meanings. A straight way to generalize this concept. fuzzy logic differs both in concept and substance from traditional multivalued logical systems. all the elements were coded with 0 or 1. In a narrow sense. fuzzy logic is a logical system. In the example. 1]. The merits of this method and its usefulness to control engineering are discussed. fuzzy logic in its narrow sense is a branch of FL. In recent years. The interpretation of the numbers. infinitely many alternatives can be allowed between the boundaries 0 and 1. This can be done by allowing not only the (crisp) decision Yes/No. In fact. which is an extension of multivalued logic.

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

you can use two types of temporal logic: event-based and absolute-time. Operators for Event-Based Temporal Logic For event-based temporal logic. In a chart with no input events. 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. wakeup) returns true if the chart has woken up n times or more since activation of the associated state. and absolute-time temporal logic defines time periods based on the simulation time of your chart.   before  before(n. the operator returns false. Otherwise. 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. You must use event notation (see Notations for Event-Based Temporal Logic) to express event-based temporal logic in state actions. after(n. In state actions and transitions.  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.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. . you can use the tick or wakeup event to denote the implicit event of a chart waking up. Operator after Syntax after(n. before(n. . use the operators as described below. A positive integer In a chart with no input events.    o o o Every temporal logic operator has an associated state: the state in which the action appears or from which the transition originates. the operator returns false.  For a chart with no input events. To operate on these recurring events or simulation time. tick)or after(n. A base event is a recurring event on which a temporal operator operates.Temporal Logic Temporal logic controls execution of a chart in terms of time. you use built-in functions called temporal logic operators. Eventbased temporal logic keeps track of recurring events. Resets the counter for E to 0 each time the associated state reactivates. of the following: Otherwise.

the operator returns false. Operator after Usage State Example on after(5. Otherwise. In a chart with no input events. at(n. wakeup) returns true if the chart has woken up for the nth time since activation of the associated state. the operator returns a value of 0. Resets the counter for E to 0 each time the associated state reactivates. Description CLK): A status message appears during . Otherwise. this operator is useful only in state actions and not in transitions. Otherwise. In a chart with no input events. 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.Operator  Syntax Description An expression that evaluates to a tick)or before(n. Examples of Event-Based Temporal Logic These examples illustrate usage of event-based temporal logic in state actions and transitions. the operator returns false. Returns true at every nth occurrence of the base event E since activation of the associated state. 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. Resets the counter for E to 0 each time the associated state reactivates. wakeup) returns true if positive integer value the chart has woken up fewer than n times since activation of the associated state. at(n. tick)or every(n. tick) orat(n. Resets the counter for E to 0 each time the associated state reactivates. at   every   every(n. Resets the counter for E to 0 each time the associated state reactivates. base event E that takes place after activation of the associated state. every(n. wakeup) returns true if the chart has woken up an integer multiple n times since activation of the associated state. Therefore.

after Transition ROTATE[after(10. A transition out of the associated state occurs only on broadcast of a ROTATEevent. . CLK)] A transition out of the associated state occurs only on broadcast of a ROTATEevent. CLK)] every State action (on every) on every(5. before before Transition ROTATE[before(10. at exactly 10 CLK cycles after activation of the state. CLK): The temp variable increments once temp++. Then. temporalCount State action (during) du: y = This action counts and returns the mm[temporalCount(tick)]. status('on'). at State action (on at) on at(10. at Transition ROTATE[at(10. CLK): A status message appears at exactly 10 CLK cycles after activation of the state. but no sooner than 10CLK cycles after activation of the state. CLK)] A transition out of the associated state occurs only on broadcast of a ROTATEevent. per CLK cycle until the state reaches the MAX limit. starting 5 clock cycles after activation of the state. the action assigns to the variable y the value of the mm array whose index is the value that thetemporalCount operator returns. CLK): A status message appears every 5 CLK cycles after activation of the state. but no later than 10 CLKcycles after activation of the state. status('on'). Description each CLK cycle. integer number of ticks that have elapsed since activation of the state. State action (on before) on before(MAX. Notations for Event-Based Temporal Logic You can use one of two notations to express event-based temporal logic.Operator Usage action (on after) Example status('on').

at. or microseconds that have elapsed since activation of a state. at. E)[C] where     tlo is a Boolean temporal logic operator (after. milliseconds. 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. These keywords are valid only in state actions and in transitions that originate from states. 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.Event Notation Use event notation to define a state action or a transition condition that depends only on a base event. E2) && C] where      E1 is any nonbase event tlo is a Boolean temporal logic operator (after. Event notation follows this syntax: tlo(n. . before. before. Example of Defining Time Delays The following continuous-time chart defines two absolute time delays in transitions. or usec to define simulation time in seconds. Conditional notation follows this syntax: E1[tlo(n.

Before t = 2 Between t = 2 and t = 5 After t = 5 A transition occurs from. until the simulation ends.33 milliseconds of simulation time. the transition from Output to Input occurs.Chart execution occurs as follows: 1. Steps 2 through 5 are repeated. . the Step block provides a unit step input to the chart. the tick event is dependent on sample time. 3.. 5. 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.. 6. When the chart awakens.. the state Input activates first. Absolute-time temporal logic works in charts that have function-call input events. The state Output deactivates. After 5. and then the state Output activates. and then the state Input activates. Example of Detecting Elapsed Time In the following model. If the input equals 1. milliseconds (msec) and microseconds (usec) syntax for the before and afteroperators.5 seconds of simulation time.. The chart determines when the input u equals 1. After 10. Absolute-time temporal logic supports seconds (sec). However. the transition from Input to Output occurs. The tick event does not work in charts with function-call inputs. 2. The state Input deactivates. 4.

msec) after Transition after(5.33. 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.34 seconds have elapsed since activation of the sec)] state.3. 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. Use theafter operator instead.3 seconds of simulation time since sec): temp = activation of the state. as shown below. tempvariable LOW. a transition out of the associated state occurs. Suppose that you want to define a time delay using the transition at(5. becomes LOW . 12.Examples of Absolute-Time Temporal Logic These examples illustrate absolute-time temporal logic in state actions and transitions. Use an outer self-loop transition with the after operator instead. . sec). usec) before Transition [temp > 75 && If the variable temp exceeds 75 and fewer than before(12. a transition out of the associated state occurs.33. After 12. a transition out of the associated state occurs. Operator Usage after State action (on after) after Example Description on after(12. After 8 milliseconds of simulation time have passed since activation of the state. Transition after(8.34. an error message appears when you try to simulate your model. an error message appears when you try to simulate your model. Change the transition to after(5. sec). After 5 microseconds of simulation time have passed since activation of the state.

as shown below. (SeeRecord State Activity Using History Junctions. as shown in the state action of Check_status.5 seconds during chart execution.) .Suppose that you want to print a status message for an active state every 2. Replace the state action with an outer self-loop transition. You must also add a history junction in the state so that the chart remembers the state settings prior to each self-loop transition.

Metric and Layered Temporal Logic for Time Granularity.html - http://ieeexplore.PhD thesis. Institute for Logic.org/xpls/abs_all. Montanari. .com/help/fuzzy/what-is-fuzzy-logic.mathworks.jsp?tp=&arnumber=1674779&url=http://ieeexplo re.mathworks.University of Amsterdam. 1996.ieee. Language and Computation.html#brh91yy-9_2 - http://www.com/help/stateflow/ug/using-temporal-logic-in-state-actionsand-transitions.jsp%3Farnumber%3D1674779 - A.Directory book http://www.ieee.org/xpl/login.

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 .