Actually, you have to programm your own membership functions related to each input. So, you have several way to perform this. The first one is to extract features such as the mean or the standard deviation. Then, you can verify if input data are gaussian distribution. If it is true, so you can programm gaussian functions and the fuzzy rules.
The easiest way to do it is use 'anfisedit' command and generate desired ANFIS in MATLAB and then select the option to 'view source'. That would be exactly what you
are trying to write.
To implement ANFIS without using the toolbox, follow these steps to write your own code:
1) Write functions for loading training, testing and checking data files
2) Generate FIS with Grid partitioning or sub clustering technique
3) Train FIS with optimization algo such as back propagation or any hybrid method
4) Initialize error tolerance and number of epochs
5) Test your model with testing data
Consider the following while implementing the ANFIS:
1) In FIS, the shape of the membership functions depends on parameters, and changing these parameters change the shape of the membership function. Analyze the data to choose the membership function parameters. Prepare data patterns so as to include sufficient training, checking and testing data. Compute the membership function parameters that best allow the associated fuzzy inference system to track the given input/output data.
2) In ANFIS you need to construct a FIS whose membership function parameters are tuned using either a back propagation algo alone or in combination with a least squares method. This kind of adjustment allows your fuzzy systems to learn from the data they are modeling.
3) The parameters associated with the membership functions changes through the learning process. The computation of these parameters is facilitated by a gradient vector. This gradient vector provides a measure of how well the fuzzy inference system is modeling the input/output data for a given set of parameters.
4) Model validation can be done by the process by passing the input vectors from input/output data sets on which the FIS was not trained, are presented to the trained FIS model, to see how well the FIS model predicts the corresponding data set output values.
You can certainly find some examples related to Fuzzy Logic Systems in the links given below. However, we are unsure of the real reasons you want to build a Sugeno-type fuzzy controller with the m-script. If the output of the m-scripted fuzzy inference system (FIS) is the same as the output of the FIS built using the Fuzzy Logic Toolbox™ GUI tool, then we don't see any motivation for doing so.
If you want to build a FIS using Custom Membership Functions, other than using the standard functions (triangular, trapezoidal, bell, gaussian, etc) in the toolbox, open the 4th link.
Perhaps you should try building a simple Sugeno FIS with the Fuzzy Logic Toolbox™ first, unless you want to build an Adaptive Fuzzy Controller, or a Genetic Algorithm optimized Fuzzy Controller, where the shapes of the input membership functions, output singleton locations and the IF-THEN rules are time-varying.