Takagi Sugeno Fuzzy Model

57 views (last 30 days)
SM
SM on 22 Apr 2022
Commented: Sam Chak on 5 Feb 2024
I am trying to write a code to build a Takagi Sugeno Fuzzy model representing a nonlinear system.
One of my consequents in the rule base is in the form of a state equation: dx/dt=Ax+Bu where x is a vector of dimension 2x1 and A is matrix of dimension 2x2 and B is a matrix of dimension 1x2. Using addvar command I want to define the output variable and also the consequent. For one dimensional equation, I am able to do it but how to write fo two dimensional equation?
a = addvar(a,varType,varName,varBounds)
  2 Comments
Benjamin Thompson
Benjamin Thompson on 22 Apr 2022
Please give the Community some information about what "Takagi Sugeno Fuzzy Model" is. Is this supported in the Fuzzy Logic Toolbox?
SM
SM on 23 Apr 2022
Yes, it is supported in the Fuzzy Logic Toolbox. I am trying to build it in a script file.
I have a nonlinear system and I have to represent it as a Fuzzy rule base in the form of set of If-Then rules.
For eg.
If x1 is NB and x2 is NB then dx/dt=A1x+Bu(1)
where NB is a fuzzy set, x1 and x2 are the states of the system and the consequent of each rule is in the form of state equation(a second order linear equation).

Sign in to comment.

Answers (1)

Shreshth
Shreshth on 5 Feb 2024
Hello SM,
I could see that you are trying to work your way through defining variables to construct a Takagi-Sugeno Fuzzy model using a two-dimensional state space equation as a consequent.
In MATLAB's Fuzzy Logic Toolbox, the ‘addvar’ function is used to add a new variable (input or output) to a fuzzy inference system (FIS) object. However, the ‘addvar’ function itself doesn't directly handle the definition of the consequent in the form of a state-space equation. Instead, you would typically use ‘addmf’ to add membership functions to the variables, and ‘addrule’ to add the rules themselves.
To represent a Takagi-Sugeno Fuzzy model where the consequent is a state-space equation, you need to define the output variables in the following way:
  1. Each component of the state-space equation can be represented as a separate output variable.
  2. For each rule, you define the linear equation that corresponds to that rule’s consequent.
Here is a conceptual example:
  • Create an empty fuzzy inference system.
  • Define the range for the input variables.
  • Add the input variables ‘x1’ and ‘x2'.
  • Adds membership functions (MFs) for x1 and x2 using ‘addMF’, with triangular shapes ('trimf') and labels 'NB' and 'PB'.
fis = addMF(fis, 'x1', 'trimf', [-10 -5 0], 'Name', 'NB');
fis = addMF(fis, 'x1', 'trimf', [0 5 10], 'Name', 'PB');
% ... similarly define other membership functions for x1 and x2
  • Defines ranges for two output variables ‘dx1dt ‘and ‘dx2dt’.
  • Adds output variables ‘dx1dt’ and ‘dx2dt’ to the FIS with their respective ranges.
  • Specifies matrices A1 and B1, which will be used in the linear equations of the consequents.
  • Adds constant membership functions for the output variables using ‘addMF’ with linear type, where the parameters are the coefficients of the state-space equations.
fis = addMF(fis, 'dx1dt', 'linear', [A1(1,:) B1(1)], 'Name', 'rule1_dx1dt');
fis = addMF(fis, 'dx2dt', 'linear', [A1(2,:) B1(2)], 'Name', 'rule1_dx2dt');
% ... similarly define other membership functions for the output variables for other rules
  • Creates a rule with the antecedent being the membership functions 'NB' for both ‘x1’ and ‘x2’, and the consequent being the linear equations represented by the membership functions ‘rule1_dx1dt’ and ‘rule1_dx2dt’.
  • Adds the rule to the FIS using ‘addRule’.
In the example above, the ‘addMF’ function for the output variables uses 'linear' as the type of membership function. The parameters of this 'linear' membership function correspond to the coefficients in the consequent linear equation, i.e., [A1(1,:) B1(1)] for ‘dx1dt’ and [A1(2,:) B1(2)] for ‘dx2dt’.
This way you could execute the Takagi-Sugeno Fuzzy Model using a two dimensional state space equation as a consequent.
For more information on the fuzzy logic toolbox functions you may refer to the below MathWorks documentation :
Thank you,
Shubham Shreshth.
  1 Comment
Sam Chak
Sam Chak on 5 Feb 2024
If you have a clear understanding of what the OP is looking for, I would appreciate it if you could utilize the Fuzzy Logic Toolbox to demonstrate the proper construction of a Takagi-Sugeno Fuzzy model for a simple nonlinear pendulum equation:
, where J, c, and k are some constants.
The output variables in this case are and .
Providing such an answer would greatly add value and increase the likelihood of it being accepted. In fact, your answer could serve as a valuable reference or tutorial for others.

Sign in to comment.

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!