%% Specify One Cluster Center Range of Influence for All Data Dimensions
% Obtain input and output training data.

Xin = [7*rand(50,1) 20*rand(50,1)-10];
Xout = 5*rand(50,1);

%
% Create a genfisOptions option set for subtractive clustering.

opt = genfisOptions('SubtractiveClustering');

% By default, the opt.ClusterInfluenceRange property is 0.5.
%
% Generate the FIS using the specified training data and options.

fismat = genfis(Xin,Xout,opt);

%
% fismat uses a range of influence of 0.5 for all data dimensions.
% To see the contents of fismat, use FIS object interfaces, e.g. fismat.Inputs, fismat.Outputs, and fismat.Rules.
% Plot the input membership functions.

[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')

% Copyright 2012-2019 The MathWorks, Inc.