Share E-Book

MATLAB Fuzzy Logic Toolbox™ Users Guide (The MathWorks, Inc.) (z-library.sk, 1lib.sk, z-lib.sk)

Author

,

Rating No ratings yet

Log in to rate

Matlab
Language English

Fuzzy Logic Toolbox provides MATLAB®functions, apps, and a Simulink®block for analyzing, designing, and simulating systems based on fuzzy logic. The product guides you through the steps of designing fuzzy inference systems. Functions are provided for many common methods, including fuzzy clustering and adaptive neurofuzzy learning. The toolbox lets you model complex system behaviors using simple logic rules, and then implement these rules in a fuzzy inference system. You can use it as a stand-alone fuzzy inference engine. Alternatively, you can use fuzzy inference blocks in Simulink and simulate the fuzzy systems within a comprehensive model of the entire dynamic system. Key Features: • Fuzzy Logic Design app for building fuzzy inference systems and viewing and analyzing results • Membership functions for creating fuzzy inference systems • Support for AND, OR, and NOT logic in user-defined rules • Standard Mamdani and Sugeno-type fuzzy inference systems • Automated membership function shaping through neuroadaptive and fuzzy clustering learning techniques • Ability to embed a fuzzy inference system in a Simulink model • Ability to generate embeddable C code or stand-alone executable fuzzy inference engines

Format PDF
Size 8.6 MB
5
Views
(First 20 pages)

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Page 1
Fuzzy Logic Toolbox™ User's Guide R2020a
Page 2
How to Contact MathWorks Latest news: www.mathworks.com Sales and services: www.mathworks.com/sales_and_services User community: www.mathworks.com/matlabcentral Technical support: www.mathworks.com/support/contact_us Phone: 508-647-7000 The MathWorks, Inc. 1 Apple Hill Drive Natick, MA 01760-2098 Fuzzy Logic Toolbox™ User's Guide © COPYRIGHT 1995–2020 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information.
Page 3
Revision History January 1995 First printing April 1997 Second printing January 1998 Third printing September 2000 Fourth printing Revised for Version 2 (Release 12) April 2003 Fifth printing June 2004 Online only Updated for Version 2.1.3 (Release 14) March 2005 Online only Updated for Version 2.2.1 (Release 14SP2) September 2005 Online only Updated for Version 2.2.2 (Release 14SP3) March 2006 Online only Updated for Version 2.2.3 (Release 2006a) September 2006 Online only Updated for Version 2.2.4 (Release 2006b) March 2007 Online only Updated for Version 2.2.5 (Release 2007a) September 2007 Online only Revised for Version 2.2.6 (Release 2007b) March 2008 Online only Revised for Version 2.2.7 (Release 2008a) October 2008 Online only Revised for Version 2.2.8 (Release 2008b) March 2009 Online only Revised for Version 2.2.9 (Release 2009a) September 2009 Online only Revised for Version 2.2.10 (Release 2009b) March 2010 Online only Revised for Version 2.2.11 (Release 2010a) September 2010 Online only Revised for Version 2.2.12 (Release 2010b) April 2011 Online only Revised for Version 2.2.13 (Release 2011a) September 2011 Online only Revised for Version 2.2.14 (Release 2011b) March 2012 Online only Revised for Version 2.2.15 (Release 2012a) September 2012 Online only Revised for Version 2.2.16 (Release 2012b) March 2013 Online only Revised for Version 2.2.17 (Release 2013a) September 2013 Online only Revised for Version 2.2.18 (Release 2013b) March 2014 Online only Revised for Version 2.2.19 (Release 2014a) October 2014 Online only Revised for Version 2.2.20 (Release 2014b) March 2015 Online only Revised for Version 2.2.21 (Release 2015a) September 2015 Online only Revised for Version 2.2.22 (Release 2015b) March 2016 Online only Revised for Version 2.2.23 (Release 2016a) September 2016 Online only Revised for Version 2.2.24 (Release 2016b) March 2017 Online only Revised for Version 2.2.25 (Release 2017a) September 2017 Online only Revised for Version 2.3 (Release 2017b) March 2018 Online only Revised for Version 2.3.1 (Release 2018a) September 2018 Online only Revised for Version 2.4 (Release 2018b) March 2019 Online only Revised for Version 2.5 (Release 2019a) September 2019 Online only Revised for Version 2.6 (Release 2019b) March 2020 Online only Revised for Version 2.7 (Release 2020a)
Page 4
(This page has no text content)
Page 5
Getting Started 1 Fuzzy Logic Toolbox Product Description . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 What Is Fuzzy Logic? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Description of Fuzzy Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Why Use Fuzzy Logic? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 When Not to Use Fuzzy Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 What Can Fuzzy Logic Toolbox Software Do? . . . . . . . . . . . . . . . . . . . . . . 1-6 Foundations of Fuzzy Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Membership Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11 Logical Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 If-Then Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-19 Fuzzy Inference Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21 Fuzzify Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21 Apply Fuzzy Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22 Apply Implication Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-23 Aggregate All Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24 Defuzzify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24 Fuzzy Inference Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25 Membership Function Gallery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-27 Defuzzification Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-29 Fuzzy vs. Nonfuzzy Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-34 Fuzzy Inference System Modeling 2 Mamdani and Sugeno Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . 2-2 Mamdani Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Sugeno Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Type-2 Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Interval Type-2 Membership Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Type-2 Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 v Contents
Page 6
Fuzzy Inference Process for Type-2 Fuzzy Systems . . . . . . . . . . . . . . . . . . 2-8 Type-Reduction Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 Build Fuzzy Systems Using Fuzzy Logic Designer . . . . . . . . . . . . . . . . . . 2-14 Fuzzy Logic Toolbox Graphical User Interface Tools . . . . . . . . . . . . . . . . 2-14 The Basic Tipping Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 The Fuzzy Logic Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 The Membership Function Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20 The Rule Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25 The Rule Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-27 The Surface Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-29 Importing and Exporting Fuzzy Inference Systems . . . . . . . . . . . . . . . . . 2-30 Build Fuzzy Systems at the Command Line . . . . . . . . . . . . . . . . . . . . . . . . 2-31 Build Fuzzy Systems Using Custom Functions . . . . . . . . . . . . . . . . . . . . . 2-40 Build Fuzzy Inference Systems Using Custom Functions in Fuzzy Logic Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-40 Specify Custom Membership Functions . . . . . . . . . . . . . . . . . . . . . . . . . 2-41 Specify Custom Inference Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45 Specify Custom Type-Reduction Functions . . . . . . . . . . . . . . . . . . . . . . . 2-50 Use Custom Functions in Code Generation . . . . . . . . . . . . . . . . . . . . . . . 2-50 Fuzzy Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52 Types of Hierarchical Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52 Add or Remove FIS Tree Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56 Use the Same Value for Multiple inputs of FIS Tree . . . . . . . . . . . . . . . . 2-56 Update Fuzzy Inference Systems in FIS Tree . . . . . . . . . . . . . . . . . . . . . 2-57 Tune a Fuzzy Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-57 Fuzzy PID Control with Type-2 FIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-58 Fuzzy Logic Image Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-72 Fuzzy Inference System Tuning 3 Tuning Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Tuning Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Prevent Overfitting of Tuned System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Improve Tuning Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 Tune Fuzzy Rules and Membership Function Parameters . . . . . . . . . . . . . 3-6 Tune Fuzzy Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 Customize FIS Tuning Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20 Tune Mamdani Fuzzy Inference System . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27 Tune FIS Tree for Gas Mileage Prediction . . . . . . . . . . . . . . . . . . . . . . . . . 3-37 vi Contents
Page 7
FIS Parameter Optimization with K-fold Cross Validation . . . . . . . . . . . . 3-50 Predict Chaotic Time Series Using Type-2 FIS . . . . . . . . . . . . . . . . . . . . . 3-57 Tune Fuzzy Robot Obstacle Avoidance System Using Custom Cost Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-70 Classify Pixels Using Fuzzy Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-81 Autonomous Parking Using Fuzzy Inference System . . . . . . . . . . . . . . . . 3-97 Neuro-Adaptive Learning and ANFIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-114 FIS Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-114 Training Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-115 Training Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-115 Display Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-116 Training Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-116 Training Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-117 Training Algorithm Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-118 Train Adaptive Neuro-Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . 3-120 Load Training Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-120 Generate or Load FIS Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-122 Train FIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-125 Validate Trained FIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-126 Importance of Checking Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-126 Save Training Error Data to MATLAB Workspace . . . . . . . . . . . . . . . . . . 3-130 Predict Chaotic Time-Series using ANFIS . . . . . . . . . . . . . . . . . . . . . . . . 3-136 Modeling Inverse Kinematics in a Robotic Arm . . . . . . . . . . . . . . . . . . . 3-144 Adaptive Noise Cancellation Using ANFIS . . . . . . . . . . . . . . . . . . . . . . . 3-152 Nonlinear System Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-160 Gas Mileage Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-173 Data Clustering 4 Fuzzy Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 What Is Data Clustering? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Fuzzy C-Means Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Subtractive Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Cluster Quasi-Random Data Using Fuzzy C-Means Clustering . . . . . . . . . 4-4 Adjust Fuzzy Overlap in Fuzzy C-Means Clustering . . . . . . . . . . . . . . . . . . 4-7 vii
Page 8
Fuzzy C-Means Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Fuzzy C-Means Clustering for Iris Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13 Model Suburban Commuting Using Subtractive Clustering . . . . . . . . . . 4-17 Modeling Traffic Patterns using Subtractive Clustering . . . . . . . . . . . . . 4-27 Data Clustering Using Clustering Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38 Load and Plot Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38 Cluster Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39 Save Cluster Centers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40 Fuzzy Logic in Simulink 5 Simulate Fuzzy Inference Systems in Simulink . . . . . . . . . . . . . . . . . . . . . 5-2 Simulate Fuzzy Inference System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Access Intermediate Fuzzy Inference Results . . . . . . . . . . . . . . . . . . . . . . 5-8 Simulation Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Map Command-Line Functionality to Fuzzy Logic Controller Block . . . . . . 5-9 Water Level Control in a Tank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11 Temperature Control in a Shower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17 Implement Fuzzy PID Controller in Simulink Using Lookup Table . . . . . 5-24 Deployment 6 Deploy Fuzzy Inference Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Generate Code in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Generate Code in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Generate Code for Fuzzy System Using Simulink Coder . . . . . . . . . . . . . . 6-3 Generate Structured Text for Fuzzy System Using Simulink PLC Coder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Generate Code for Fuzzy System Using MATLAB Coder . . . . . . . . . . . . . 6-10 viii Contents
Page 9
Apps 7 Functions 8 Objects 9 Blocks 10 Appendices 11 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 ix
Page 10
(This page has no text content)
Page 11
Getting Started • “Fuzzy Logic Toolbox Product Description” on page 1-2 • “What Is Fuzzy Logic?” on page 1-3 • “Foundations of Fuzzy Logic” on page 1-8 • “Fuzzy Inference Process” on page 1-21 • “Membership Function Gallery” on page 1-27 • “Defuzzification Methods” on page 1-29 • “Fuzzy vs. Nonfuzzy Logic” on page 1-34 1
Page 12
Fuzzy Logic Toolbox Product Description Design and simulate fuzzy logic systems Fuzzy Logic Toolbox provides MATLAB® functions, apps, and a Simulink® block for analyzing, designing, and simulating systems based on fuzzy logic. The product guides you through the steps of designing fuzzy inference systems. Functions are provided for many common methods, including fuzzy clustering and adaptive neurofuzzy learning. The toolbox lets you model complex system behaviors using simple logic rules, and then implement these rules in a fuzzy inference system. You can use it as a stand-alone fuzzy inference engine. Alternatively, you can use fuzzy inference blocks in Simulink and simulate the fuzzy systems within a comprehensive model of the entire dynamic system. Key Features • Fuzzy Logic Design app for building fuzzy inference systems and viewing and analyzing results • Membership functions for creating fuzzy inference systems • Support for AND, OR, and NOT logic in user-defined rules • Standard Mamdani and Sugeno-type fuzzy inference systems • Automated membership function shaping through neuroadaptive and fuzzy clustering learning techniques • Ability to embed a fuzzy inference system in a Simulink model • Ability to generate embeddable C code or stand-alone executable fuzzy inference engines 1 Getting Started 1-2
Page 13
What Is Fuzzy Logic? Description of Fuzzy Logic In recent years, the number and variety of applications of fuzzy logic have increased significantly. The applications range from consumer products such as cameras, camcorders, washing machines, and microwave ovens to industrial process control, medical instrumentation, decision-support systems, and portfolio selection. To understand why use of fuzzy logic has grown, you must first understand what is meant by fuzzy logic. Fuzzy logic has two different meanings. In a narrow sense, fuzzy logic is a logical system, which is an extension of multivalued logic. However, in a wider sense fuzzy logic (FL) is almost synonymous with the theory of fuzzy sets, a theory which relates to classes of objects with unsharp boundaries in which membership is a matter of degree. In this perspective, fuzzy logic in its narrow sense is a branch of FL. Even in its more narrow definition, fuzzy logic differs both in concept and substance from traditional multivalued logical systems. In Fuzzy Logic Toolbox software, fuzzy logic should be interpreted as FL, that is, fuzzy logic in its wide sense. The basic ideas underlying FL are explained in “Foundations of Fuzzy Logic” on page 1- 8. What might be added is that the basic concept underlying FL is that of a linguistic variable, that is, a variable whose values are words rather than numbers. In effect, much of FL may be viewed as a methodology for computing with words rather than numbers. Although words are inherently less precise than numbers, their use is closer to human intuition. Furthermore, computing with words exploits the tolerance for imprecision and thereby lowers the cost of solution. Another basic concept in FL, which plays a central role in most of its applications, is that of a fuzzy if- then rule or, simply, fuzzy rule. Although rule-based systems have a long history of use in Artificial Intelligence (AI), what is missing in such systems is a mechanism for dealing with fuzzy consequents and fuzzy antecedents. In fuzzy logic, this mechanism is provided by the calculus of fuzzy rules. The calculus of fuzzy rules serves as a basis for what might be called the Fuzzy Dependency and Command Language (FDCL). Although FDCL is not used explicitly in the toolbox, it is effectively one of its principal constituents. In most of the applications of fuzzy logic, a fuzzy logic solution is, in reality, a translation of a human solution into FDCL. A trend that is growing in visibility relates to the use of fuzzy logic in combination with neurocomputing and genetic algorithms. More generally, fuzzy logic, neurocomputing, and genetic algorithms may be viewed as the principal constituents of what might be called soft computing. Unlike the traditional, hard computing, soft computing accommodates the imprecision of the real world. The guiding principle of soft computing is: Exploit the tolerance for imprecision, uncertainty, and partial truth to achieve tractability, robustness, and low solution cost. In the future, soft computing could play an increasingly important role in the conception and design of systems whose MIQ (Machine IQ) is much higher than that of systems designed by conventional methods. Among various combinations of methodologies in soft computing, the one that has highest visibility at this juncture is that of fuzzy logic and neurocomputing, leading to neuro-fuzzy systems. Within fuzzy logic, such systems play a particularly important role in the induction of rules from observations. An effective method developed by Dr. Roger Jang for this purpose is called ANFIS (Adaptive Neuro-Fuzzy Inference System). This method is an important component of the toolbox. Fuzzy logic is all about the relative importance of precision: How important is it to be exactly right when a rough answer will do? What Is Fuzzy Logic? 1-3
Page 14
You can use Fuzzy Logic Toolbox software with MATLAB technical computing software as a tool for solving problems with fuzzy logic. Fuzzy logic is a fascinating area of research because it does a good job of trading off between significance and precision — something that humans have been managing for a very long time. In this sense, fuzzy logic is both old and new because, although the modern and methodical science of fuzzy logic is still young, the concepts of fuzzy logic relies on age-old skills of human reasoning. Fuzzy logic is a convenient way to map an input space to an output space. Mapping input to output is the starting point for everything. Consider the following examples: • With information about how good your service was at a restaurant, a fuzzy logic system can tell you what the tip should be. • With your specification of how hot you want the water, a fuzzy logic system can adjust the faucet valve to the right setting. • With information about how far away the subject of your photograph is, a fuzzy logic system can focus the lens for you. • With information about how fast the car is going and how hard the motor is working, a fuzzy logic system can shift gears for you. A graphical example of an input-output map is shown in the following figure. 1 Getting Started 1-4
Page 15
Determining the appropriate amount of tip requires mapping inputs to the appropriate outputs. Between the input and the output, the preceding figure shows a black box that can contain any number of things: fuzzy systems, linear systems, expert systems, neural networks, differential equations, interpolated multidimensional lookup tables, or even a spiritual advisor, just to name a few of the possible options. Clearly the list could go on and on. Of the dozens of ways to make the black box work, it turns out that fuzzy is often the very best way. Why should that be? As Lotfi Zadeh, who is considered to be the father of fuzzy logic, once remarked: "In almost every case you can build the same product without fuzzy logic, but fuzzy is faster and cheaper." Why Use Fuzzy Logic? Here is a list of general observations about fuzzy logic: • Fuzzy logic is conceptually easy to understand. The mathematical concepts behind fuzzy reasoning are very simple. Fuzzy logic is a more intuitive approach without the far-reaching complexity. • Fuzzy logic is flexible. With any given system, it is easy to layer on more functionality without starting again from scratch. • Fuzzy logic is tolerant of imprecise data. Everything is imprecise if you look closely enough, but more than that, most things are imprecise even on careful inspection. Fuzzy reasoning builds this understanding into the process rather than tacking it onto the end. • Fuzzy logic can model nonlinear functions of arbitrary complexity. You can create a fuzzy system to match any set of input-output data. This process is made particularly easy by adaptive techniques like Adaptive Neuro-Fuzzy Inference Systems (ANFIS), which are available in Fuzzy Logic Toolbox software. • Fuzzy logic can be built on top of the experience of experts. In direct contrast to neural networks, which take training data and generate opaque, impenetrable models, fuzzy logic lets you rely on the experience of people who already understand your system. What Is Fuzzy Logic? 1-5
Page 16
• Fuzzy logic can be blended with conventional control techniques. Fuzzy systems don't necessarily replace conventional control methods. In many cases fuzzy systems augment them and simplify their implementation. • Fuzzy logic is based on natural language. The basis for fuzzy logic is the basis for human communication. This observation underpins many of the other statements about fuzzy logic. Because fuzzy logic is built on the structures of qualitative description used in everyday language, fuzzy logic is easy to use. The last statement is perhaps the most important one and deserves more discussion. Natural language, which is used by ordinary people on a daily basis, has been shaped by thousands of years of human history to be convenient and efficient. Sentences written in ordinary language represent a triumph of efficient communication. When Not to Use Fuzzy Logic Fuzzy logic is not a cure-all. When should you not use fuzzy logic? The safest statement is the first one made in this introduction: fuzzy logic is a convenient way to map an input space to an output space. If you find it's not convenient, try something else. If a simpler solution already exists, use it. Fuzzy logic is the codification of common sense — use common sense when you implement it and you will probably make the right decision. Many controllers, for example, do a fine job without using fuzzy logic. However, if you take the time to become familiar with fuzzy logic, you'll see it can be a very powerful tool for dealing quickly and efficiently with imprecision and nonlinearity. What Can Fuzzy Logic Toolbox Software Do? You can create and edit fuzzy inference systems with Fuzzy Logic Toolbox software. You can create these systems using graphical tools or command-line functions, or you can generate them automatically using either clustering or adaptive neuro-fuzzy techniques. If you have access to Simulink software, you can easily test your fuzzy system in a block diagram simulation environment. The toolbox also lets you run your own stand-alone C programs directly. This is made possible by a stand-alone Fuzzy Inference Engine that reads the fuzzy systems saved from a MATLAB session. You can customize the stand-alone engine to build fuzzy inference into your own code. All provided code is ANSI® compliant. 1 Getting Started 1-6
Page 17
Because of the integrated nature of the MATLAB environment, you can create your own tools to customize the toolbox or harness it with another toolbox, such as the Control System Toolbox™, Deep Learning Toolbox™, or Optimization Toolbox™ software. See Also More About • “Foundations of Fuzzy Logic” on page 1-8 • “Fuzzy vs. Nonfuzzy Logic” on page 1-34 What Is Fuzzy Logic? 1-7
Page 18
Foundations of Fuzzy Logic Overview The point of fuzzy logic is to map an input space to an output space, and the primary mechanism for doing this is a list of if-then statements called rules. All rules are evaluated in parallel, and the order of the rules is unimportant. The rules themselves are useful because they refer to variables and the adjectives that describe those variables. Before you can build a system that interprets rules, you must define all the terms you plan on using and the adjectives that describe them. To say that the water is hot, you need to define the range that the water's temperature can be expected to vary as well as what we mean by the word hot. The following diagram provides a roadmap for the fuzzy inference process. It shows the general description of a fuzzy system on the left and a specific fuzzy system on the right. To summarize the concept of fuzzy inference depicted in this figure, fuzzy inference is a method that interprets the values in the input vector and, based on some set of rules, assigns values to the output vector. This topic guides you through the fuzzy logic process step by step by providing an introduction to the theory and practice of fuzzy logic. Fuzzy Sets Fuzzy logic starts with the concept of a fuzzy set. A fuzzy set is a set without a crisp, clearly defined boundary. It can contain elements with only a partial degree of membership. To understand what a fuzzy set is, first consider the definition of a classical set. A classical set is a container that wholly includes or wholly excludes any given element. For example, the set of days of the week unquestionably includes Monday, Thursday, and Saturday. It just as unquestionably excludes butter, liberty, and dorsal fins, and so on. 1 Getting Started 1-8
Page 19
This type of set is called a classical set because it has been around for a long time. It was Aristotle who first formulated the Law of the Excluded Middle, which says X must either be in set A or in set not-A. Another version of this law is: Of any subject, one thing must be either asserted or denied. To restate this law with annotations: "Of any subject (say Monday), one thing (a day of the week) must be either asserted or denied (I assert that Monday is a day of the week)." This law demands that opposites, the two categories A and not-A, should between them contain the entire universe. Everything falls into either one group or the other. There is no thing that is both a day of the week and not a day of the week. Now, consider the set of days comprising a weekend. The following diagram attempts to classify the weekend days. Most would agree that Saturday and Sunday belong, but what about Friday? It feels like a part of the weekend, but somehow it seems like it should be technically excluded. Thus, in the preceding diagram, Friday tries its best to "straddle on the fence." Classical or normal sets would not tolerate this kind of classification. Either something is in or it is out. Human experience suggests something different, however, straddling the fence is part of life. Of course individual perceptions and cultural background must be taken into account when you define what constitutes the weekend. Even the dictionary is imprecise, defining the weekend as the period from Friday night or Saturday to Monday morning. You are entering the realm where sharp- edged, yes-no logic stops being helpful. Fuzzy reasoning becomes valuable exactly when you work with how people really perceive the concept weekend as opposed to a simple-minded classification useful for accounting purposes only. More than anything else, the following statement lays the foundations for fuzzy logic. In fuzzy logic, the truth of any statement becomes a matter of degree. Any statement can be fuzzy. The major advantage that fuzzy reasoning offers is the ability to reply to a yes-no question with a not-quite-yes-or-no answer. Humans do this kind of thing all the time (think how rarely you get a straight answer to a seemingly simple question), but it is a rather new trick for computers. How does it work? Reasoning in fuzzy logic is just a matter of generalizing the familiar yes-no (Boolean) logic. If you give true the numerical value of 1 and false the numerical value of 0, this value indicates that fuzzy logic also permits in-between values like 0.2 and 0.7453. For instance: Q: Is Saturday a weekend day? A: 1 (yes, or true) Q: Is Tuesday a weekend day? A: 0 (no, or false) Q: Is Friday a weekend day? Foundations of Fuzzy Logic 1-9
Page 20
A: 0.8 (for the most part yes, but not completely) Q: Is Sunday a weekend day? A: 0.95 (yes, but not quite as much as Saturday). The following plot on the left shows the truth values for weekend-ness if you are forced to respond with an absolute yes or no response. On the right, is a plot that shows the truth value for weekend- ness if you are allowed to respond with fuzzy in-between values. Technically, the representation on the right is from the domain of multivalued logic (or multivalent logic). If you ask the question "Is X a member of set A?" the answer might be yes, no, or any one of a thousand intermediate values in between. Thus, X might have partial membership in A. Multivalued logic stands in direct contrast to the more familiar concept of two-valued (or bivalent yes-no) logic. To return to the example, now consider a continuous scale time plot of weekend-ness shown in the following plots. By making the plot continuous, you are defining the degree to which any given instant belongs in the weekend rather than an entire day. In the plot on the left, notice that at midnight on Friday, just as the second hand sweeps past 12, the weekend-ness truth value jumps discontinuously from 0 to 1. This is one way to define the weekend, and while it may be useful to an accountant, it may not really connect with your own real-world experience of weekend-ness. The plot on the right shows a smoothly varying curve that accounts for the fact that all of Friday, and, to a small degree, parts of Thursday, partake of the quality of weekend-ness and thus deserve partial membership in the fuzzy set of weekend moments. The curve that defines the weekend-ness of any instant in time is a function that maps the input space (time of the week) to the output space (weekend-ness). Specifically it is known as a membership function. See “Membership Functions” on page 1-11 for a more detailed discussion. As another example of fuzzy sets, consider the question of seasons. What season is it right now? In the northern hemisphere, summer officially begins at the exact moment in the earth's orbit when the North Pole is pointed most directly toward the sun. It occurs exactly once a year, in late June. Using the astronomical definitions for the season, you get sharp boundaries as shown on the left in the 1 Getting Started 1-10
The above is a preview of the first 20 pages. Register to read the complete e-book.

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
← Back to List