Takagi Sugeno Fuzzy Model

45 次查看(过去 30 天)
SM
SM 2022-4-22
评论: Sam Chak 2024-2-5
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 个评论
Benjamin Thompson
Benjamin Thompson 2022-4-22
Please give the Community some information about what "Takagi Sugeno Fuzzy Model" is. Is this supported in the Fuzzy Logic Toolbox?
SM
SM 2022-4-23
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).

请先登录,再进行评论。

回答(1 个)

Shreshth
Shreshth 2024-2-5
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 个评论
Sam Chak
Sam Chak 2024-2-5
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by