| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Fuzzy Logic Toolbox |
| Contents | Index |
| Learn more about Fuzzy Logic Toolbox |
fismat = genfis2(Xin,Xout,radii) fismat = genfis2(Xin,Xout,radii,xBounds) fismat = genfis2(Xin,Xout,radii,xBounds,options) fismat = genfis2(Xin,Xout,radii,xBounds,options,user_centers)
genfis2 generates a Sugeno-type FIS structure using subtractive clustering and requires separate sets of input and output data as input arguments. When there is only one output, genfis2 may be used to generate an initial FIS for anfis training. genfis2 accomplishes this by extracting a set of rules that models the data behavior.
The rule extraction method first uses the subclust function to determine the number of rules and antecedent membership functions and then uses linear least squares estimation to determine each rule's consequent equations. This function returns a FIS structure that contains a set of fuzzy rules to cover the feature space.
The arguments for genfis2 are as follows:
Xin is a matrix in which each row contains the input values of a data point.
Xout is a matrix in which each row contains the output values of a data point.
radii is a vector that specifies a cluster center's range of influence in each of the data dimensions, assuming the data falls within a unit hyperbox.
For example, if the data dimension is 3 (e.g., Xin has two columns and Xout has one column), radii = [0.5 0.4 0.3] specifies that the ranges of influence in the first, second, and third data dimensions (i.e., the first column of Xin, the second column of Xin, and the column of Xout) are 0.5, 0.4, and 0.3 times the width of the data space, respectively. If radii is a scalar value, then this scalar value is applied to all data dimensions, i.e., each cluster center has a spherical neighborhood of influence with the given radius.
xBounds is a 2-by-N optional matrix that specifies how to map the data in Xin and Xout into a unit hyperbox, where N is the data (row) dimension. The first row of xBounds contains the minimum axis range values and the second row contains the maximum axis range values for scaling the data in each dimension.
For example, xBounds = [-10 0 -1; 10 50 1] specifies that data values in the first data dimension are to be scaled from the range [-10 +10] into values in the range [0 1]; data values in the second data dimension are to be scaled from the range [0 50]; and data values in the third data dimension are to be scaled from the range [-1 +1]. If xBounds is an empty matrix or not provided, then xBounds defaults to the minimum and maximum data values found in each data dimension.
options is an optional vector for specifying algorithm parameters to override the default values. These parameters are explained in the help text for subclust. Default values are in place when this argument is not specified.
user_centers is an optional matrix for specifying custom cluster centers. user_centers has a size of J-by-N where J is the number of clusters and N is the total number of inputs and outputs.
The default input membership function type is 'gaussmf', and the default output membership function type is 'linear'.
The following table summarizes the default inference methods.
| Inference Method | Default |
|---|---|
| AND | prod |
| OR | probor |
| Implication | prod |
| Aggregation | max |
| Defuzzification | wtaver |
The following example uses the genfis2 function with the minimum number of arguments and generates a FIS with default values. In this case, a range of influence of 0.5 is specified for all data dimensions.
Xin1 = 7*rand(50,1); Xin2 = 20*rand(50,1)-10; Xin = [Xin1 Xin2]; Xout = 5*rand(50,1); fismat = genfis2(Xin,Xout,0.5);
showfis(fismat) displays the contents of each field of the structure fismat.
To plot the input membership functions, type
[x,mf] = plotmf(fismat,'input',1);
subplot(2,1,1), plot(x,mf);
xlabel('Membership Functions for input 1');
[x,mf] = plotmf(fismat,'input',2);
subplot(2,1,2), plot(x,mf);
xlabel('Membership Functions for input 2');

The following example assumes the combined data dimension is 3. Suppose Xin has two columns and Xout has one column, then 0.5 and 0.25 are the ranges of influence for each of the Xin data dimensions, and 0.3 is the range of influence for the Xout data dimension.
Xin1 = 7*rand(50,1); Xin2 = 20*rand(50,1)-10; Xin = [Xin1 Xin2]; Xout = 5*rand(50,1); fismat = genfis2(Xin,Xout,[0.5 0.25 0.3])
The following example specifies how to normalize the data in Xin and Xout into values in the range [0 1] for processing. Suppose Xin has two columns and Xout has one column, then the data in the first column of Xin are scaled from [-10 +10], the data in the second column of Xin are scaled from [-5 +5], and the data in Xout are scaled from [0 20].
Xin1 = 7*rand(50,1); Xin2 = 20*rand(50,1)-10; Xin = [Xin1 Xin2]; Xout = 5*rand(50,1); fismat = genfis2(Xin,Xout,0.5,[-10 -5 0; 10 5 20])
subclust, genfis1, genfis3, anfis
![]() | genfis1 | genfis3 | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |