# Example Of Fuzzy Associative Matrix Fam Computer Science Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In the year of 1973, Lotfali Askar Zadeh was proposed the theory of fuzzy logic or multi-valued logic from the fuzzy set theory. It is a problem-solving methodology which consists of numerous applications to control and process the information. Fuzzy logic provides inference mechanisms that enable approximate reasoning and model human reasoning capabilities to be applied to knowledge-based systems [1]. So, fuzzy logic can obtain the definite conclusions from vague or imprecise information because it capable to imitate human decision making by obtain from the imprecise data and to find a precise solution.

Basically, fuzzy logic is a set of mathematical principles for knowledge which is based on the degrees of membership. Thus, fuzzy logic is defined as multi-valued that consists of the logical values range between 0 and 1 instead of Boolean logic is a two-valued logic which just consists of 0 and 1 only. Besides the value represent in black and white, fuzzy logic employs the spectrum of colours which can express and accepting the things to be partly true and partly false at the same time. By applied human knowledge and experience, fuzzy logic can easy to modelling a complex nonlinear system to match the given output data. It is different from the classical logic which needs a highly understanding, exact and known equations, and precise data. Therefore, the increasing acceptance of fuzzy logic in automation, aerospace, electronic devices and manufacturing industry due to its ability in embedded control application, high performance, simple, lower cost and high productivity.

Figure 1.1: Boolean Logic. Figure 1.2: Fuzzy Logic.

1.2 Fuzzy Set

Fuzzy sets are sets whose elements have degrees of membership [2]. Fuzzy set is introduced by Lotfali Askar Zadeh in year 1965 to manipulate data and information to processing the uncertainties or precise. The theory of fuzzy sets provides a mathematical apparatus to capture and handle the uncertainty and vagueness inherently associated with human cognitive processes, such as perception, thinking, reasoning, decision making, etc [1].

For a classical set, there are only two values and it is describe the items with the value of 0 and 1. While for the fuzzy set which is a set have a membership function characteristic which assigns to each item ranging values between 0 (complete exclusion) and 1(complete membership). The membership values define the degrees of an object according their properties or feature distinctive.

For a tall men example, it is categorize with fuzzy sets of short, average and tall men. From the figure below, we can obtain that a man have a tall height of 184cm which is in the category of average men set with a degree of membership of 0.1 but at the same time he also in the category of tall men set with a degree of membership of 0.4.

Figure 1.3: Membership Function of Tall Man.

1.3 Fuzzy Rules

A fuzzy system has a capability to implement human-like decision making. All the decisions and the average of choosing those decisions are based on the fuzzy sets and fuzzy rules which using the If-Then statements to obtain the output from the membership function. A fuzzy rule can be defined as a conditional or situational statement. For instance, If x is A, Then y is B, where those A and B are the values determined by fuzzy sets on x and y. For the men height example, if the men height is tall then the men weight is heavy.

When there have two or more possible input combination, the output can be determined by using the Fuzzy Association Matrix (FAM) which expressed the fuzzy logic in tabular form. Those possible inputs are commonly combined by using the AND or OR logic conjunctives. For an example, if a student able finished the exam paper in a short time and the student is completely know how to answer the questions, then the student can score in exam paper with grade A.

Time/ Level

Long

Medium

Short

Don't Know

D

D

D

Somewhat Know

C

C

B

Completely Know

B

A

A

Table 1.1: Example of Fuzzy Associative Matrix (FAM)

1.4 Fuzzy Defuzzification

It is the process to obtain the crisp or actual result in fuzzy system by the given fuzzy sets and the degrees of membership function. With the appearance of the membership degrees of the fuzzy sets, it can be interpreting into a specific decision or actual value. There are two commonly used defuzzification methods: the centre of gravity method and the mean of maxima method [4].

Centroid of area (COA) or Centre of gravity (COG) defuzzification method is the most commonly appealing among the defuzzification techniques. This technique was developed by Sugeno in 1985 [5]. It can obtain the accurate result from this technique. The Centroid of area can be express as below, where is the defuzzified output, is the aggregated memebership function and z is the output variable.

Figure 1.4: Centroid of area method.

Mean of maxima defuzzification method is similar to the centroid of area method. The defuzzified result represents the mean value of all actions, whose membership functions reach the maximum [6]. The mean of maxima defuzzification method can be express as below, where zj is the control action whose membership functions reach the maximum and k is the number of such control actions.

Figure 1.5: Mean of maxima method.

1.5 Fuzzy Inference System

Fuzzy inference system is to formulate and execute the given input to obtain an output by using the fuzzy logic. This process involves of fuzzify inputs, application of fuzzy operator, apply implication method, aggregate outputs, and defuzzification in order to get the output. There are two types of fuzzy inference system which are Mamdani fuzzy model and Sugeno fuzzy model. For a Mamdani-type system, it can capture expect knowledge and describe it more human-like manner. While a Sugeno-type system can deal with the output membership functions which either in linear or constant in the model of inference.

Observation data or measurements are known as inputs are fuzzied by fuzzier. After mapping the fuzzy set and activation of fuzzy rules, the output fuzzy set is then computed through the process of inference. Lastly, a defuzzification process is performed and obtains the output result.

Figure 1.6: Illustrate of Fuzzy Inference system.

1.6 Neural Networks

Neural Networks also known as Artificial Neural Networks. It is a mathematical model that will mimics human brain and function as parallel distributed computing networks. A first model of an artificial neuron is proposed by McCulloch and Pitts after they had been studied and research on Artificial Neural Networks for few years. They emphasized that combining of many simple processing units together could lead to an overall increase in computational power. Later on, the importance of the connections between artificial neurons to the process learning is emphasized by Hebb's psychological study. It consists of processing elements are called nodes, units or artificial neurons and the connection between them with coefficients bound to these connections.

In the artificial neural network, it contains essential characteristic features such as learning from the examples and adaption, generalization, massive parallelism, distributed and associative storage of information, robustness and fault tolerance. Through the learning, the connection weights change in such a way that the network learns to produce desired outputs for known inputs. If new input data that different from the known examples are supplied to the network, it produces the best output according to the example used.

Figure 1.7: Neural Network.

There are several inputs into the neuron which denoted as X1, X2, X3,..Xi, ..Xn are given the respective weights W1, W2, W3, ..Wi, ..Wn and it contributes the value of Xi*Wi to the neuron as input.

1.7 Classification of Neural Network

Neural networks can be classified based on network architecture, input and output relationship and learning algorithm. Based on the neural network structure or architecture, there are two common type network which are feed forward network and feedback network. For the feed forward network, each of neuron in a layer is connected to only neurons of the next layers. Signal is then transfer in forward direction from input, hidden until to the output layer, so there are no any of feedback connections. A common example of neural network performing this architecture is called feed forward error back propagation network. There are usually applied on pattern recognition, interpolation and others.

Figure 1.8: A Free Forward Network.

Feedback network which have the connections from one layer connect back to the previous layer and connection of one neuron itself. The training of such network is rather loaded. So, the process is more complicated if compared to the feed forward network.

Figure 1.9: A Feedback Network.

For the classification based on relationship between input and output of network, it classified as Hetroassociative and Autoassociateive network. In the hetriassociative network, it has separate input and output domain which the vectors from the input domain to corresponding vectors in the output domain. While for the autoassociateive network, it works in a single domain which the network associates same data to both input and output.

Lastly, for the classification based on learning algorithm, it has two methods of learning which are supervised and unsupervised. In the supervised method, an algorithm that trains the network so that the mapping falls under supervised training to produce from the given input to desired output. The computer is instructed to compare any inputs to ideal response, and any discrepancy between the new inputs and ideal responses is recorded [7]. A common network which is implemented supervised learning method which is called back propagation network. In the unsupervised method, there are no corresponding output patterns because it alternatively aims with respect to the input. The system evaluates a range of patterns and identifies similarities and dissimilarities among them [7]. So, most of the response is organized by network itself.

1.8 Combination of Fuzzy and Artificial Neural Network

The artificial neural network have an ability of learning, adaption, optimization, and processing numerical data that coming from the databases and network-like structure with its high fault tolerance. Basically, it is used to tune the membership functions of fuzzy systems that are playing a role as decision making systems for controlling equipment. Fuzzy logic can encode expert knowledge by using rules with linguistic labels, but it consumed a lot of time to design and tune the membership functions. However, the appearance of neural network learning techniques can automate this process and reduce the time and cost while improving the performance.

Both neural networks and fuzzy systems have their own advantages and disadvantages. For the neural network, the disadvantages are the learning process is relatively slow and analysis of the trained network is difficult. While the disadvantages of fuzzy system, it can be explained based on fuzzy rules and performance can be adjusted by tuning the rules. In order to overcome the problems, neural networks are extended automatically extract fuzzy rules from the numerical data.

There are two ways of merging artificial neural networks with fuzzy sets and logic. The first attempt which called Neuro Fuzzy Systems is to use of artificial neural networks within the framework of fuzzy modelling and designing fuzzy systems. The second attempt which called Fuzzy Neural Networks is to use of the fuzzy sets and logic as a tool within the framework of the artificial neural network methodology. In this report, the Neuro Fuzzy Systems is chosen and designed for the adaptive cutting tool path generation algorithm in order to achieve the objective.

1.9 Objective and Overview of the Project

Nowadays, the arise of CNC machines are increasing the productivity, reducing cost and time consuming, produce the high precision of machining parts due to the high demand of the manufacturing in automation and robotics technology. However, the existing CNC machines are implementing just only able to generate the tool pats for the analytical curves or surface machining. Therefore, it is hard to generate the tool path in the free-form or parametric surface which modelled by the modern CAD systems due to the growing role of computer-based technologies. In order to produce and generate the tool path not only in the analytical form but also in free-form or parametric, a tool path generation algorithm is introduced and developed to resolve this kind of limitations.

The objective of this project is to develop and design the neuro fuzzy system into the CNC interpolator which to meet the accuracy of the output and improve the efficiency of the system. Neuro fuzzy system have to be robust, adaptively ability and it can able to generate the desired path that in the tolerance requirement. Therefore, there are two type of neuro fuzzy systems will be simulated and studied for this project.

1.10 Adaptive Tool Path Generation Algorithm

A tool path generation algorithm is able to generating the tool path on the surfaces which is in curve or sculptured form. In order to produces the surface curve in parametric form, the determination of vector is made by the tool path generation algorithm between the points of current location, Pi and next location, Pi+1 to ensure that the vector is parallel to the unit tangent of surface curve of the initial point of current position. The position of the cutter which is driven with constant feedrate of V (mm/s) in the duration of t second defined as the next step position. Thus, the equation is obtained for the next step position is, where the.

Although the tool path generation can replicate the desired contour but there is no tolerance checking mechanism in the algorithm. Due to the exception of the tolerance checking mechanism, the tool path generation may strays out of the allowable tolerance. Therefore, an adaptive mechanism is introduced for the tool path generation algorithm in order to steer the cutting path back and stay in the allowable tolerance.

Figure 1.3: Possible current positions and next positions in the desired geometric shape of the surface curve.

From the figure above, there are three possibilities of cutter's next step position will be located either in the desired position, inside the curve or outside the curve. The equations are defined as the below:

Di is the sign of the current position while the δ is the magnitude of the cutter at its next step position of its desired location. The next step position must be corrected if the magnitude of deviation is greater than the magnitude of allowable tolerance, δ all to ensure that it always in the tolerant condition. This adjustment can be done by increasing or decreasing rotating the step length at the current position with until the magnitude of deviation, δ is less than magnitude of allowable tolerance, δ all.

Table1.1 : Adaptive Rules

## Deviation Sign For Current Position

## Deviation Sign For Next Step Position

## Deviation For Next Step Position

## Action

Di < 0

Di+1 < 0

δ ≤ δall

Pi = Pi+1

δ > δall

increment âˆ†θ2

Di+1 > 0

δ ≤ δall

Pi = Pi+1

δ > δall

decrement âˆ†θ2

Di+1 = 0

δ = 0

Pi = Pi+1

Di = 0

Di+1 < 0

δ ≤ δall

Pi = Pi+1

δ > δall

increment âˆ†θ2

Di+1 > 0

δ ≤ δall

Pi = Pi+1

δ > δall

decrement âˆ†θ2

Di+1 = 0

δ = 0

Pi = Pi+1

Di > 0

Di+1 < 0

δ ≤ δall

Pi = Pi+1

δ > δall

increment âˆ†θ2

Di+1 > 0

δ ≤ δall

Pi = Pi+1

δ > δall

decrement âˆ†θ2

Di+1 = 0

δ = 0

Pi = Pi+1

Figure 1.4: The step size of the cutting.

The component of the position difference between the next step and the current position is expressed in term of and.

From the figure 2, the components of the corrected position of differential rotation can be determined by using the geometry relationship with the spherical coordinate system variables. So, the step size can be written as below:

After comparing the equations at the above and expanding the angle-sum relations, the equations of components of the corrected position became as:

The equations is then applying the definition of cosine to the right triangle PQR in the figure 2, we obtains the equation:

The terms of and can be approximately by and since the . SO, the equation rewritten as

The cutter path generation are summarized into the flow chart at the below:

Determine the position Signs and next step position error

δ ≤ δall ?

Determine and compute the direction and differential rotation

Corrected position

End

Start

YES

NO

Figure 1.5: Error adjustment mechanism flow chart.

## CHAPTER 2: LITERATURE REVIEW

2.1 Interpolator

An interpolator is a component of CNC machine and it can reflecting the accuracy and generated the axis movement data from the block data which is generated by the interpreter. A CNC machine generally has more than two controlled axes to machine complex shapes. Two kinds of control can be carried out: The point-to-point method is used to move the axis to the desired position; and the contour control method is used to move the axis along an arbitrary curve [3]. The interpolator should divide the movement into individual displacement with predefined feederate in order to achieve the control method successfully.

There are two types of interpolator which are hardware interpolator and software interpolator. A hardware interpolator is based on the computation interpolation and it can generate pulse by using an electric circuit. It can operate in high speed execution but it hinder to adapt to a new algorithm. It uses DDA (Digital Differential Analyzer) integrator [3] to transform into a software version in the modern CNC machine so that the hardware interpolation method can be executed.

A software interpolator is slightly different than hardware interpolator which its interpolation is using a computer program instead of logic arithmetic hardware device compared to hardware interpolator. There have two types of interpolation method which can uses in software interpolator. There are reference pulse method and reference word method or sampled data method. For the reference pulse method, generated reference pulses will causes pulses directly into the machine and an external interrupt signal will occurred. For the reference word method or sampled data method, it must executed in two stage which input a segmented contour into straight line segment in an allowable tolerance in the first stage and interpolated the line segment by transfer the result to the related axis in the second stage.

2.2 NURBS Interpolation

Non-uniform Rational Basis Spline or in short NURBS is known as a mathematical model is widely implement in computer graphics design for generation of both analytical and freeform surfaces. With NURBS geometry it is possible to define the free-form curves with complex shapes by using less data and to represent various geometric shapes by changing parameters [3]. Among the various mathematical models such as cubic-spline, Bezier, B-spline, and NURBS, NURBS is most general model which used to generating free-form curves in CAD or CAM systems.

Basically, NURBS curve is define in the mathematical form, where P is the degree of the B-spline basic function, Pi is the control point i, and wi is the weight of Pi.

The B-spline basis function, Ni,p(u) is shown as below, where ui is the knots for the NURBS curve.

A shape of a NURBS curve is determined by based on the control points which clarify the curve basic position, weights define the importance of individual control points and knots has the right to choose the tangents of curves. By adjusting the weight, the control point, and the knot vector of a NURBS curve it is possible to represent curves with various shapes [3]. As a good result in geometric properties, NURBS is multiply the knot vector which equal to 1 and satisfies at least C2 continuity of the curve. So, free-form shapes are usually represented by using the NURBS geometry in the new CAD systems.

2.3 NURBS Interpolation Algorithm

In the Sampled-Data interpolation method, the NURBS interpolation algorithm is used in this section to determine the interpolated points with a maximum allowable interpolation error at first and then determine whether it is exceeds the allowable acceleration. If the point is satisfies the allowable acceleration, a new interpolated point is calculated.

Figure 2.2: Adapting step length to curvature.

The curvature curve in the figure above, the interpolation error, h is varies for a free form curve is calculated. Therefore, the center point (xc, yc) from the interpolated point (xi, yi) and the successive interpolated point (xi+1, yi+1) is always compared with the midpoint of the curve between the points (xi, yi) and (xi+1, yi+1). If found that the interpolation error, h is greater than the maximum allowable interpolation error, , it may causes the next interpolated point moves closer to the current interpolated point (xi, yi) due to the curvature is too high and hard to satisfy the maximum allowable interpolation error. Thus, The new interpolated point (x'i+1, y'i+1) is calculated as it closer to the point (xi, yi) and compare again to the maximum allowable error, .

In order to calculate the interpolation error, h, we can use the below equation:

Where F is the federate, is the interpolation iteration time and PQ =.

The maximum allowable feederate, can be obtain from this equation, where the is the maximum allowable interpolation error.

## CHAPTER 3: METHODOLOGY AND DESIGN

3.1 Tolerance Adjustment Mechanism

As discussed in the previous chapter, a tolerance adjustment checking mechanism is added into the tool path generation. The equation to calculate the displacement tolerance between the current position and desired position is stated as below:

After the displacement tolerance is calculated, it has to check whether it is falling in the allowable zone or not. If there are found that the tolerance is falling in the allowable zone, the adjustment mechanism will end its function and proceed to the next position. Otherwise, it has to make a correction by using those formulas:

Equation of component of corrected position:

After made a correction, the adjustment mechanism will return back to recalculate and recheck the tolerance. If it meets the allowable displacement tolerance, the tolerance checking mechanism will stop its function.

Table 3.1: Sampling step and total adjustment loop of different feed rate for with normal adjustment.

## Tolerance

0.01

0.02

## Feed Rate

## Step Size

## Total Adjustment Loop

5

337

224

0

10

169

175

139

15

113

173

121

20

85

164

105

25

68

146

87

30

57

134

103

Table 3.2: The intensity of different feed rate for normal adjustment.

## Tolerance

0.01

0.02

## Feed Rate

5

0.6447

0

10

1.0355

0.8225

15

1.5310

1.0708

20

1.9294

1.2353

25

2.1471

1.2794

30

2.3509

1.8070

Table 3.3: Sampling step and total adjustment loop of different feed rate for with Sugeno fuzzy adjustment.

## Tolerance

0.01

0.02

## Feed Rate

## Step Size

## Total Adjustment Loop

5

337

74

0

10

169

50

25

15

113

49

23

20

85

48

20

25

68

42

16

30

57

37

21

Table 3.4: Table 3.2: The intensity of different feed rate for Sugeno fuzzy adjustment.

## Tolerance

0.01

0.02

## Feed Rate

5

0.2196

0

10

0.2959

0.1479

15

0.4336

0.2035

20

0.5647

0.2353

25

0.6176

0.2353

30

0.6491

0.3684

Table 3.5: Number of loop generated by normal, Sugeno fuzzy, and Mamdani fuzzy adjustment with feed rate= 30mm/s and tolerance= 0.01.

Step

Loop

Normal Adjustment

Fuzzy (Sugeno) Adjustment

Fuzzy (Mamdani) Adjustment

1

0

0

0

2

0

0

0

3

7

1

1

4

6

1

1

5

5

1

1

6

4

1

1

7

3

1

1

8

2

1

1

9

2

1

1

10

2

1

1

11

3

1

1

12

3

1

1

13

3

1

1

14

3

1

1

15

3

1

1

16

3

1

1

17

3

0

0

18

0

0

0

19

0

0

0

20

0

0

0

21

0

0

0

22

0

0

0

23

0

0

0

24

0

0

0

25

0

0

0

26

0

0

0

27

0

0

0

28

2

1

1

29

2

1

1

30

2

1

1

31

2

1

1

32

3

1

1

33

3

1

1

34

3

1

1

35

3

1

1

36

3

1

1

37

3

1

1

38

3

1

1

39

3

1

1

40

3

0

0

41

0

0

0

42

0

0

0

43

0

0

0

44

0

0

0

45

0

0

0

46

0

0

0

47

0

0

0

48

2

1

1

49

2

1

1

50

3

1

1

51

4

1

1

52

5

1

1

53

5

1

1

54

6

1

1

55

7

1

1

56

9

1

2

57

4

2

2