| 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 = genfis3(Xin,Xout) fismat = genfis3(Xin,Xout,type) fismat = genfis3(Xin,Xout,type,cluster_n) fismat = genfis3(Xin,Xout,type,cluster_n,fcmoptions)
genfis3 generates a FIS using fuzzy c-means (FCM) clustering by extracting a set of rules that models the data behavior. The function requires separate sets of input and output data as input arguments. When there is only one output, you can use genfis3 to generate an initial FIS for anfis training. The rule extraction method first uses the fcm function to determine the number of rules and membership functions for the antecedents and consequents.
fismat = genfis3(Xin,Xout) generates a Sugeno-type FIS structure (fismat) given input data Xin and output data Xout. The matrices Xin and Xout have one column per FIS input and output, respectively.
fismat = genfis3(Xin,Xout,type) generates a FIS structure of the specified type, where type is either 'mamdani' or 'sugeno'.
fismat = genfis3(Xin,Xout,type,cluster_n) generates a FIS structure of the specified type and allows you to specify the number of clusters (cluster_n) to be generated by FCM.
The number of clusters determines the number of rules and membership functions in the generated FIS. cluster_n must be an integer or 'auto'. When cluster_n is 'auto', the function uses the subclust algorithm with a radii of 0.5 and the minimum and maximum values of Xin and Xout as xBounds to find the number of clusters. See subclust for more information.
fismat = genfis3(Xin,Xout,type,cluster_n,fcmoptions) generates a FIS structure of the specified type and number of clusters and uses the specified fcmoptions for the FCM algorithm. If you omit fcmoptions, the function uses the default FCM values. See fcm for information about these parameters.
The input membership function type defaults to 'gaussmf', and the output membership function type defaults to 'linear'.
The following table summarizes the default inference methods.
| Inference Method | Default |
|---|---|
| AND | prod |
| OR | probor |
| Implication | prod |
| Aggregation | sum |
| Defuzzification | wtaver |
The following example uses the genfis3 function with the minimum number of arguments and generates a FIS using default values.
Xin1 = 7*rand(50,1); Xin2 = 20*rand(50,1)-10; Xin = [Xin1 Xin2]; Xout = 5*rand(50,1); fismat = genfis3(Xin,Xout);
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 generates a Mamdani FIS with three clusters.
Xin1 = 7*rand(50,1); Xin2 = 20*rand(50,1)-10; Xin = [Xin1 Xin2]; Xout = 5*rand(50,1); fismat = genfis3(Xin,Xout,'mamdani',3)
The following example specifies the type of FIS, the number of desired clusters and FCM options.
Xin1 = 7*rand(50,1); Xin2 = 20*rand(50,1)-10; Xin = [Xin1 Xin2]; Xout = 5*rand(50,1); fis = genfis3(Xin,Xout,'mamdani',3,[2,100,1e-5,1])
![]() | genfis2 | gensurf | ![]() |

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 |