# Fuzzy Logic-Based Controller for Bipedal Robot
## 5 The Fuzzy Controller for Bipedal Robot
### Fuzzification
#### 5.1.3 Set Up Membership Function of Linguistic Variables  
To perform fuzzy operations and fuzzy inference, the input data must be assigned membership values of one or more fuzzy sets into which the universe of discourse has been partitioned. There are different methods for assigning membership values or membership functions to fuzzy variables. Here the membership functions of the right trapezoid, triangle, and left trapezoid were used to represent the membership values of the linguistic variables  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**No.** & **Levels \(X_{i}\)** & **Fuzzy Set \(Fi\)** & **Name of Linguistic Value** & **Notation of Linguistic Value** \\ \hline
1 & \(X_{1}\) & \(F_{1}\) & Big Negative & NB \\
2 & \(X_{2}\) & \(F_{2}\) & Small Negative & NS \\
3 & \(X_{3}\) & \(F_{3}\) & Zero & Z \\
4 & \(X_{4}\) & \(F_{4}\) & Small Positive & PS \\
5 & \(X_{5}\) & \(F_{5}\) & Big Positive & PB \\ \hline \hline \end{tabular}
\end{table}
Table 2: Description of levels of the discretized universe of discourse, fuzzy sets, linguistic value terms, and notations, of the inputs and outputs.  
\(e(t)\), \(\dot{e}(t)\), and \(U(t)\). Figure 13 shows the membership functions of fuzzy sets of linguistic variables, defined on the partitioned universe of discourse, where the physical values of linguistic variables at the discretized points of the universe of discourse were determined as follows: NB = x\({}_{i,\min}\); NS = 0.75x\({}_{i,\min}\) + 0.25x\({}_{i,\max}\); Z = 0.5x\({}_{i,\min}\) + 0.5x\({}_{i,\max}\); PS = 0.25x\({}_{i,\min}\) + 0.75x\({}_{i,\max}\); PB = x\({}_{i,\max}\).  
By applying the membership function types mentioned above and from Figure 13, it was easy to determine the Support (defined domain) of the fuzzy sets of a linguistic variable Supp(\(F_{i}\))(\(i\) = 1,..., 5). In addition, given the physical values of the language variable, it was easy to calculate its membership value as below.  
The membership value of the linguistic variable of the fuzzy set \(F_{1}\), Support Supp(\(F_{1}\)) = [NB, NS]:  
\[\mu_{Fi}(x_{i})=\left\{\begin{array}{ll}1&\text{if }x_{i}\leq\text{NB}\\ \frac{\text{NS}-x_{i}}{\text{NS}-\text{NB}}&\text{if }\text{NB}\leq x_{i}\leq\text{NS}\\ 0&\text{if }x_{i}\geq\text{NS}\end{array}\right. \tag{21}\]  
The membership value of the linguistic variable of the fuzzy set \(F_{5}\), Support Supp(\(F_{5}\)) = [PS,PB]:  
\[\mu_{Fi}(x_{i})=\left\{\begin{array}{ll}0&\text{if }x_{i}\leq\text{PS}\\ \frac{x_{i}-\text{PS}}{\text{PB}-\text{PS}}&\text{if }\text{PS}\leq x_{i}\leq\text{ PB}\\ 1&\text{if }x_{i}\geq\text{PB}\end{array}\right. \tag{22}\]  
For the membership value of the linguistic variable of the fuzzy set \(F_{i}\)(\(i\) = 2,3,4), let us call its Support as Supp(\(F_{i}\)) = [\(a_{1}\), \(a_{2}\)]:  
\[\mu_{Fi}(x_{i})=\left\{\begin{array}{ll}\frac{x_{i}-a_{1}}{a_{0}-a_{1}}& \text{if }a_{1}\leq x_{i}\leq a_{0};\;a_{0}=\frac{a_{1}+a_{2}}{2}\\ \frac{a_{2}-x_{i}}{a_{2}-a_{0}}&\text{if }a_{0}\leq x_{i}\leq a_{2}\\ 0&\text{if }x_{i}\leq a_{1}\text{ or }x_{i}\geq a_{2}\end{array}\right. \tag{23}\]