Matlab Toolbox

7
SYS735 Intelligent Control Systems KaCC FL3 - Matlab Fuzzy Logic Toolbox 1 3-Feb-01 MATLAB FUZZY LOGIC TOOLBOX » help fuzzy Fuzzy Logic Toolbox. Version 2.0.1 (R11) 16-Sep-1998 GUI editors anfisedit - ANFIS training and testing UI tool. findcluster- Clustering UI tool. fuzzy - Basic FIS editor. mfedit - Membership function editor. ruleedit - Rule editor and parser. ruleview - Rule viewer and fuzzy inference diagram. surfview - Output surface viewer. Membership functions. dsigmf - Difference of two sigmoid membership functions. gauss2mf - Two-sided Gaussian curve membership function. gaussmf - Gaussian curve membership function. gbellmf - Generalized bell curve membership function. pimf - Pi-shaped curve membership function. psigmf - Product of two sigmoid membership functions. smf - S-shaped curve membership function. sigmf - Sigmoid curve membership function. trapmf - Trapezoidal membership function. trimf - Triangular membership function. zmf - Z-shaped curve membership function. Command line FIS functions addmf - Add membership function to FIS addrule - Add rule to FIS. addvar - Add variable to FIS. defuzz - Defuzzify membership function. evalfis - Perform fuzzy inference calculation. evalmf - Generic membership function evaluation. gensurf - Generate FIS output surface. getfis - Get fuzzy system properties. mf2mf - Translate parameters between functions. newfis - Create new FIS. parsrule - Parse fuzzy rules. plotfis - Display FIS input-output diagram. plotmf - Display all membership functions for one variable. readfis - Load FIS from disk. rmmf - Remove membership function from FIS. rmvar - Remove variable from FIS. setfis - Set fuzzy system properties. showfis - Display annotated FIS. showrule - Display FIS rules. writefis - Save FIS to disk. Advanced techniques anfis - Training routine for Sugeno-type FIS (MEX only).

Transcript of Matlab Toolbox

Page 1: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 1 3-Feb-01

MATLAB FUZZY LOGIC TOOLBOX

» help fuzzy Fuzzy Logic Toolbox. Version 2.0.1 (R11) 16-Sep-1998 GUI editors anfisedit - ANFIS training and testing UI tool. findcluster- Clustering UI tool. fuzzy - Basic FIS editor. mfedit - Membership function editor. ruleedit - Rule editor and parser. ruleview - Rule viewer and fuzzy inference diagram. surfview - Output surface viewer. Membership functions. dsigmf - Difference of two sigmoid membership functions. gauss2mf - Two-sided Gaussian curve membership function. gaussmf - Gaussian curve membership function. gbellmf - Generalized bell curve membership function. pimf - Pi-shaped curve membership function. psigmf - Product of two sigmoid membership functions. smf - S-shaped curve membership function. sigmf - Sigmoid curve membership function. trapmf - Trapezoidal membership function. trimf - Triangular membership function. zmf - Z-shaped curve membership function. Command line FIS functions addmf - Add membership function to FIS addrule - Add rule to FIS. addvar - Add variable to FIS. defuzz - Defuzzify membership function. evalfis - Perform fuzzy inference calculation. evalmf - Generic membership function evaluation. gensurf - Generate FIS output surface. getfis - Get fuzzy system properties. mf2mf - Translate parameters between functions. newfis - Create new FIS. parsrule - Parse fuzzy rules. plotfis - Display FIS input-output diagram. plotmf - Display all membership functions for one variable. readfis - Load FIS from disk. rmmf - Remove membership function from FIS. rmvar - Remove variable from FIS. setfis - Set fuzzy system properties. showfis - Display annotated FIS. showrule - Display FIS rules. writefis - Save FIS to disk. Advanced techniques anfis - Training routine for Sugeno-type FIS (MEX only).

Page 2: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 2 3-Feb-01

fcm - Find clusters with fuzzy c-means clustering. genfis1 - Generate FIS matrix using generic method. genfis2 - Generate FIS matrix using subtractive clustering. subclust - Estimate cluster centers with subtractive clustering. Miscellaneous functions convertfis - Convert v1.0 fu zzy matrix to v2.0 fuzzy structure. discfis - Discretize a fuzzy inference system. evalmmf - For multiple membership functions evaluation. fstrvcat - Concatenate matrices of varying size. fuzarith - Fuzzy arithmatic function. findrow - Find the rows of a matrix that match the input string. genparam - Generates initial premise parameters for ANFIS learning. probor - Probabilistic OR. sugmax - Maximum output range for a Sugeno system. GUI helper files cmfdlg - Add customized membership function dialog. cmthdlg - Add customized inference method dialog. fisgui - Generic GUI handling for the Fuzzy Logic Toolbox gfmfdlg - Generate fis using grid partition method dialog. mfdlg - Add membership function dialog. mfdrag - Drag membership functions using mouse. popundo - Pull the last change off the undo stack. pushundo - Push the current FIS data onto the undo stack. savedlg - Save before closing dialog. statmsg - Display messages in a status field. updtfis - Update Fuzzy Logic Toolbox GUI tools. wsdlg - Open from/save to workspace dialog. fuzzy is both a directory and a function. FUZZY Basic FIS editor. The FIS Ed itor displays high-level information about a Fuzzy Inference System. At the top is a diagram of the system with each input and output clearly labeled. By double-clicking on the input or output boxes, you can bring up the Membership Function Editor. Double-clicking on the fuzzy rule box in the center of the diagram will bring up the Rule Editor. Just below the diagram is a text field that displays the name of the current FIS. In the lower left of the window are a series of popup menus that allow you to specify the various functions used in the fuzzy implication process. In the lower right are fields that provide information about the current variable. The current variable is determined by clicking once on one of the input or output boxes. See also MFEDIT, RULEEDIT, RULEVIEW, SURFVIEW, ANFISEDIT.

Page 3: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 3 3-Feb-01

EXAMPLE on using MATLAB FUZZY LOGIC TOOLBOX

If Service is Excellent or Food is Delicious then Tip is Generous. At this time, let’s bring in a little help from our friend Matlab Fuzzy Logic Toolbox. At the Matlab prompt >>, type fuzzy The FIS Editor allows one to build and evaluate a fuzzy inference system that interprets fuzzy rules. It lets us define the fuzzy sets and rules. We would like to define the antecedent: If Service is Excellent or Food is Delicious There are two fuzzy input variables: Service and Food So click on Edit and select Add Input to add a second input.

Page 4: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 4 3-Feb-01

Click on the block for input1, input2 and output1, and change their variable names to Service, Food and Tip. Next, we wish to define a membership for excellent. Double click on the block for Service

Click Edit Add MF

Select 1 for one membership function

Select sigmf

Edit range to [0 10]

Click on graph to change shape & drag it left or eight

Click to highlight curve & label the function as Excellent

Page 5: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 5 3-Feb-01

Similarly define the membership function for Food And also the membership function for the output Tip. This is what you may mean by a Generous tip.

Page 6: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 6 3-Feb-01

To set up the rules, click on the block called “Untitled Mamdani” in the FIS Editor Select “or” since this is the condition in the antecedent. Click Add Rule And the fuzzy rule for tipping automatically appears. From the any of the viewer windows, you may select View and select Rule Viewer Play around with the service and food quality, and see how the tip is affected. Figure out the logic by observing the interaction From the View menu, you may also select Surface Viewer. It shows what the tipping rule is saying as a whole. Is this what you think of when you tip? Joke or fact: Guys tend to tip more if the waitress is friendly!

Page 7: Matlab Toolbox

SYS735 Intelligent Control Systems KaCC

FL3 - Matlab Fuzzy Logic Toolbox 7 3-Feb-01

Observation & Discussion via Q &A Q: How does the rating 0 to 10 for Service & Food get translated to a membership degree or value? A: Q: Observe the “or” operation. What math operation is taking place? How did we set that up? A: Q: What is the result of the operation in the antecedent? A: Q: How does the result of the antecedent affect the shape of the output membership function? A: Q: How does the shape of the affected output membership function generate the final outcome (how much tip)? A: Add an additional rule to the existing FIS to say that If Service is Poor or Food is Rancid, then Tip is Poor Play with the two rules Fuzzy Inference System and observe the outcome. AND what if you want to impress the waitperson (a girl or guy). How would you add a rule to incorporate this logic in the tip. If Waitperson is Friendly, then Tip is Extra.