0% found this document useful (0 votes)
474 views206 pages

Defuzzification Method in Matlab PDF

Uploaded by

Moonlit Bleeds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
474 views206 pages

Defuzzification Method in Matlab PDF

Uploaded by

Moonlit Bleeds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 206

Snehashish Chakraverty ·

Deepti Moyi Sahoo · Nisha Rani Mahato

Concepts
of Soft
Computing
Fuzzy and ANN with Programming
Concepts of Soft Computing
Snehashish Chakraverty

Deepti Moyi Sahoo Nisha Rani Mahato


Concepts of Soft Computing


Fuzzy and ANN with Programming

123
Snehashish Chakraverty Deepti Moyi Sahoo
Department of Mathematics Department of Mathematics,
National Institute of Technology Rourkela School of Science
Rourkela, Odisha, India O.P. Jindal University
Punjipathra, India
Nisha Rani Mahato
Department of Mathematics
National Institute of Technology Rourkela
Rourkela, Odisha, India

ISBN 978-981-13-7429-6 ISBN 978-981-13-7430-2 (eBook)


https://doi.org/10.1007/978-981-13-7430-2

Library of Congress Control Number: 2019935543

© Springer Nature Singapore Pte Ltd. 2019


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this
publication does not imply, even in the absence of a specific statement, that such names are exempt from
the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this
book are believed to be true and accurate at the date of publication. Neither the publisher nor the
authors or the editors give a warranty, expressed or implied, with respect to the material contained
herein or for any errors or omissions that may have been made. The publisher remains neutral with regard
to jurisdictional claims in published maps and institutional affiliations.

This Springer imprint is published by the registered company Springer Nature Singapore Pte Ltd.
The registered company address is: 152 Beach Road, #21-01/04 Gateway East, Singapore 189721,
Singapore
Preface

In the early 1990s, soft computing (SC) gained popularity due to its efficiency in
handling problems with imprecision, approximation, decision making, and uncer-
tainty. Unlike earlier hard computing techniques which dealt with precision, soft
computing techniques consider imprecision to obtain rigorous, computationally
efficient, and robust results. The fascinating ability of soft computing techniques to
deal with human intelligence, reasoning, analysis, learning, imprecision, and mul-
titasking has made it favorable in various scientific and technological disciplines,
viz. computer science, mathematics, control theory, structural engineering, medical,
management, psychology, etc. Generally, the principal constituents of soft com-
puting include techniques focusing on fuzzy system, evolutionary computation,
machine learning, and probabilistic reasoning. In this regard, this book starts with
an introductory chapter for a brief knowledge about soft computing and its various
constituents.
Among the various constituents discussed above, fuzzy systems and machine
learning have acquired much attention in solving real-world problems dealing with
imprecision or approximations. There exist several books that deal with one or more
constituents of soft computing. But, two major concepts, viz. fuzzy set theory and
neural network, form the basic platforms of fuzzy systems and machine learning,
respectively. In this regard, the computational programming paradigm of the fuzzy
set theory concepts and artificial neural network (ANN) models is essential for their
functioning in various science and engineering disciplines. But as per the best of
our knowledge, books covering the basic concepts of fuzzy set theory and ANN in a
detailed as well as systematic manner along with programming are scarce.
Accordingly, the authors realized the need for such a book that contains a concise
and systematic description of various concepts in fuzzy set theory and ANN along
with step-by-step C and/or MATLAB codes addressing simple solved example
problems for a better understanding. Another key feature of this book is that it also
provides partial attention to handle interval uncertainty.
As regards, the book is mainly divided into two parts focusing on major soft
computing techniques, viz. fuzzy set theory and ANN. The fuzzy set theory part
comprises nine chapters, and ANN comprises the rest of the chapters. As a whole,

v
vi Preface

the book consists of 14 chapters giving basic knowledge of fuzzy set theory and
ANN. Before we incorporate the details of the book, the authors assume that the
readers have prerequisite knowledge of calculus, set theory, and linear algebra. In
fuzzy set theory, a fuzzy number may be approximately represented in terms of
closed intervals using a-cut approach. As such, Chap. 1 comprises basic prelimi-
naries related to intervals, interval arithmetic and interval matrices, accompanied
with C and MATLAB programs. Then, Chap. 2 introduces the fundamentals related
to fuzzy sets with respect to the extension of crisp (classical) sets based on its
membership function. Chapter 3 discusses various types of fuzzy numbers, and
particularly, conversions of such fuzzy numbers to intervals have been done using
a-cut approach. Chapter 4 emphasizes other properties of fuzzy sets such as rela-
tions and compositions on fuzzy relations. Chapter 5 elaborates different types of
fuzzy functions along with C or MATLAB codes related to fuzzy functions.
Chapter 6 provides the extension of classical differentiation and integration to fuzzy
differentiation and integration. Chapter 7 includes the methodology of the trans-
formation of fuzzy sets to crisp sets in terms of defuzzification methods. Chapters 8
and 9 discuss special importance of applications using interval computation in the
system of equations and eigenvalue problems, respectively, that may be further
extended to fuzzy number with respect to the parameter a. Chapters 7–10 include
MATLAB programs only for most of the solved problems.
Chapters 10–14 introduce a computing paradigm known as ANN. Chapter 10
emphasizes mainly on the basic foundation of ANN. Chapter 11 contains
McCulloch–Pitts model. Chapters 12 and 13 contain different learning algorithms.
Further, Chap. 14 includes delta learning rule and backpropagation methods.
Chapters 10–14 present MATLAB programming codes for most of the ANN titles
for variety of problems. In order to emphasize the importance of 14 chapters
mentioned above, few unsolved problems have also been included at the end of
some chapters for self-validation of the topics. Moreover, corresponding bibli-
ographies are given at the end of each chapter for ease and better referencing.
This book is mainly written for undergraduate and graduate courses all over the
world. It covers topics related to the basics of soft computing, fuzzy set theory, and
neural networks. This book may also be used by researchers, industry, faculties,
etc., for understanding the two challenging soft computing techniques, viz. fuzzy
set theory and ANN, along with programming techniques. Further, the idea for
solving the uncertain system of equations and eigenvalue problems occurring in
science and engineering disciplines has also been incorporated.

Rourkela, India Snehashish Chakraverty


Punjipathra, India Deepti Moyi Sahoo
Rourkela, India Nisha Rani Mahato
Acknowledgements

The first author greatly appreciates the support, encouragement, and patience pro-
vided by his family members, in particular his wife Shewli and daughters Shreyati
and Susprihaa. Further, the book may not have been possible without the blessings
of his beloved parents late Sh. Birendra K. Chakraborty and Smt. Parul
Chakraborty.
The second author would like to express her sincere gratitude to her family
members, especially Sh. Daya Nidhi Sahoo, Smt. Tilottama Sahoo, Trupti Moyi
Sahoo, and Deepak Kumar Sahoo, for their love and blessings. Last but not least,
the author also wants to thank her beloved son Nishit, husband Mr. Soumyaranjan
Sahoo, father-in-law Sh. Duryodhan Sahoo, and mother-in-law Smt. Rukmini
Sahoo for showing their faith and giving liberty to do all the things.
Finally, the third author’s warmest gratitude goes to her family members for
their continuous support and motivation, especially Sh. Devendra Mahato,
Smt. Premshila, Tanuja, Devasish, and Satish.
Also second and third authors greatly appreciate the inspiration of the first author
for his support and inspiration which helped a lot to learn new things. This work
would not have been possible without his guidance, support, and encouragement.
Authors sincerely acknowledge the reviewers for their fruitful suggestions and
appreciations of the book proposal. Further, all the authors do appreciate the sup-
port and help of the whole team of Springer. Finally, authors are greatly indebted to
the authors/researchers mentioned in the Bibliography section given at the end of
each chapter.

Snehashish Chakraverty
Deepti Moyi Sahoo
Nisha Rani Mahato

vii
Contents

Part I Fuzzy Set Theory


1 Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Preliminaries of Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Addition and Subtraction of Intervals . . . . . . . . . . . . . 5
1.1.2 Multiplication of Intervals . . . . . . . . . . . . . . . . . . . . . . 7
1.1.3 Division and Inverse of Intervals . . . . . . . . . . . . . . . . . 8
1.2 Interval Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.1 Arithmetic Operations on Interval Matrices . . . . . . . . . 18
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2 Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.1 Preliminaries of Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 Generating Membership Function . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Support, Height, Core, and Boundary of Fuzzy Set . . . . . . . . . . 31
2.4 Intersection, Union, and Complement . . . . . . . . . . . . . . . . . . . . 35
2.5 Other Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.6 Extension Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3 Fuzzy Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.1 Preliminaries of Fuzzy Numbers . . . . . . . . . . . . . . . . . . . . . . . 53
3.2 Types of Fuzzy Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.2.1 Triangular Fuzzy Number (TFN) . . . . . . . . . . . . . . . . . 55
3.2.2 Trapezoidal Fuzzy Number (TrFN) . . . . . . . . . . . . . . . 58
3.2.3 Gaussian Fuzzy Number (GFN) . . . . . . . . . . . . . . . . . 61
3.3 Conversion of Fuzzy Number to Interval Form Using a-Cut . . . 65
3.3.1 Triangular Fuzzy Number a-Cut Decomposition . . . . . 65
3.3.2 Trapezoidal Fuzzy Number a-Cut Decomposition . . . . 66
3.3.3 Gaussian Fuzzy Number a-Cut Decomposition . . . . . . 66

ix
x Contents

3.4 Fuzzy Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66


3.4.1 Arithmetic Operations of Fuzzy Numbers . . . . . . . . . . 67
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4 Fuzzy Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.1 Preliminaries of Fuzzy Relations . . . . . . . . . . . . . . . . . . . . . . . 71
4.2 Intersection, Union, and Complement . . . . . . . . . . . . . . . . . . . . 72
4.3 First, Second, and Total Projection . . . . . . . . . . . . . . . . . . . . . 78
4.4 Composition of Fuzzy Relations . . . . . . . . . . . . . . . . . . . . . . . 83
4.5 Fuzzy Equivalence Relation . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5 Fuzzy Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.1 Preliminaries of Crisp Function . . . . . . . . . . . . . . . . . . . . . . . . 95
5.2 Preliminaries of Fuzzy Function . . . . . . . . . . . . . . . . . . . . . . . 96
5.3 Types of Fuzzy Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.3.1 Type I Fuzzy Function . . . . . . . . . . . . . . . . . . . . . . . . 96
5.3.2 Type II Fuzzy Function . . . . . . . . . . . . . . . . . . . . . . . 99
5.3.3 Type III Fuzzy Function . . . . . . . . . . . . . . . . . . . . . . . 101
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6 Fuzzy Differentiation and Integration . . . . . . . . . . . . . . . . . . . . . . . 105
6.1 Fuzzy Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.1.1 Fuzzifying Function at Crisp Point . . . . . . . . . . . . . . . 106
6.1.2 Crisp Function at Fuzzy Point . . . . . . . . . . . . . . . . . . . 108
6.2 Fuzzy Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.2.1 Fuzzifying Function Over Crisp Limits . . . . . . . . . . . . 110
6.2.2 Crisp Function Over Fuzzy Limits . . . . . . . . . . . . . . . . 112
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7 Defuzzification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.1 Defuzzification Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
7.1.1 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
7.1.2 Max-Membership Method . . . . . . . . . . . . . . . . . . . . . . 121
7.1.3 Centroid Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.1.4 Weighted-Average Method . . . . . . . . . . . . . . . . . . . . . 126
7.1.5 Mean–Max Method . . . . . . . . . . . . . . . . . . . . . . . . . . 126
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
8 Interval System of Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . 129
8.1 System of Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
8.2 Interval System of Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 130
8.2.1 Methods for Solving ISLEs . . . . . . . . . . . . . . . . . . . . . 130
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Contents xi

9 Interval Eigenvalue Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141


9.1 Eigenvalue Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
9.1.1 Standard Eigenvalue Problems . . . . . . . . . . . . . . . . . . 142
9.1.2 Generalized Eigenvalue Problems . . . . . . . . . . . . . . . . 143
9.2 Interval Eigenvalue Problems . . . . . . . . . . . . . . . . . . . . . . . . . 145
9.2.1 Vertex Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

Part II Artificial Neural Network


10 Artificial Neural Network Terminologies . . . . . . . . . . . . . . . . . . . . . 153
10.1 Artificial Neural Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
10.2 Network Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
10.2.1 Single Layer Neural Network . . . . . . . . . . . . . . . . . . . 154
10.2.2 Multilayer Neural Network . . . . . . . . . . . . . . . . . . . . . 154
10.2.3 Competitive Layer Neural Network . . . . . . . . . . . . . . . 155
10.3 Different Training Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.3.1 Supervised Training . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.3.2 Unsupervised Training . . . . . . . . . . . . . . . . . . . . . . . . 156
10.4 Activation Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
10.4.1 Some Common Activation Function . . . . . . . . . . . . . . 158
10.4.2 Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
10.4.3 Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
10.4.4 Threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
10.5 Computing Net Input Using Matrix Multiplication Method . . . . 160
10.6 Matlab Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
10.6.1 Write a Matlab Program to Generate the Following
Activation Functions That Are Used in Neural
Networks: (a) Identity Function, (b) Binary Step
Function with Threshold Value 1 and 0, (c) Binary
Sigmoid Function, and (d) Bipolar Sigmoid
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
10.6.2 Write a Program in Matlab if the Net Input to an
Output Neuron Is 0.38, Calculate Its Output When the
Activation Function Is (a) Binary Sigmoid Function
and (b) Bipolar Sigmoid Function . . . . . . . . . . . . . . . . 164
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
11 McCulloch–Pitts Neural Network Model . . . . . . . . . . . . . . . . . . . . . 167
11.1 McCulloch–Pitts Neural Network Model . . . . . . . . . . . . . . . . . 167
11.2 McCulloch–Pitts Neuron Architecture . . . . . . . . . . . . . . . . . . . 167
11.3 Matlab Programs for McCulloch–Pitts Neuron Model . . . . . . . . 168
11.3.1 Write a Matlab Program to Generate the Output of
Logic AND Function by McCulloch–Pitts Neuron
Model. The Threshold on Unit Is 2 . . . . . . . . . . . . . . . 168
xii Contents

11.3.2 Write a Matlab Program to Generate Output for OR


Function Using McCulloch–Pitts Neurons with
Threshold Value 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
11.3.3 Write a Matlab Program to Generate Output for XOR
Function Using McCulloch–Pitts Neurons with
Threshold Value 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
11.3.4 Write a Matlab Program to Generate Output for
ANDNOT Function Using McCulloch–Pitts
Neurons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
12 Hebbian Learning Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
12.1 Hebbian Net Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
12.2 Hebbian Learning Rule Algorithm . . . . . . . . . . . . . . . . . . . . . . 176
12.3 Matlab Programs Using Hebbian Learning Rule . . . . . . . . . . . . 176
12.3.1 Write a Matlab Program to Train XOR Function
Using Hebbian Learning with Bipolar Input and
Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
12.3.2 (a) Write a Matlab Program Using Hebbian Learning
Rule to Find the Weights Required to Perform
the Following Classifications. Vectors (1 1 1 1)
and (−1 1 −1 −1) Are Members of Class (with Target
Value 1); Vectors (1 1 1 −1) and (1 −1 −1 1) Are Not
Members of Class (with Target Value −1) . . . . . . . . . . 177
12.3.3 (b) Using Each of the Training x Vectors as Input,
Test the Response of the Net . . . . . . . . . . . . . . . . . . . 179
12.4 Matlab Programs for Pattern Classification Using Hebb Net . . . 180
12.4.1 Write a Matlab Program for Hebbian Network to
Classify Two-Dimensional Input Patterns in Bipolar
with Their Targets Given Below: . . . . . . . . . . . . . . . . 180
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
13 Perceptron Learning Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
13.1 Single Layer Perceptron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
13.2 Architecture of Single Layer Perceptron . . . . . . . . . . . . . . . . . . 183
13.3 Algorithm of Single Layer Perceptron . . . . . . . . . . . . . . . . . . . 183
13.4 Matlab Programs Using Perceptron Learning Rule . . . . . . . . . . 185
13.4.1 Write a Matlab Program for and Function with
Bipolar Inputs and Targets Using Perceptron Learning
Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
13.4.2 Write a Matlab Program for AND Function with
Binary Inputs and Bipolar Targets Without Bias up to
2 Epochs Using Perceptron Learning Algorithm . . . . . . 186
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Contents xiii

14 Delta Learning Rule and Backpropagation Rule for Multilayer


Perceptron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
14.1 Feedforward Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
14.2 Delta Learning Rule or Backpropagation Rule . . . . . . . . . . . . . 189
14.3 Training Algorithm with Unipolar Sigmoid Function . . . . . . . . 189
14.4 Training Algorithm with Bipolar Sigmoid Function . . . . . . . . . 191
14.5 Matlab Programs for Multilayer Neural Network Using
Backpropagation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
14.5.1 Write a Matlab Program to Find the New Weights for
Input Patterns [0.6 0.8 0] and Target Output is 0.9.
Use Learning Rate Alpha = 0.3 and Use Binary
Sigmoid Activation Function . . . . . . . . . . . . . . . . . . . . 193
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
About the Authors

Prof. Snehashish Chakraverty has 27 years of experience as a researcher and is


currently a Professor at the Department of Mathematics at National Institute of
Technology, Rourkela, Odisha. He holds an M.Sc. in Mathematics, M.Phil. in
Computer Applications and a Ph.D. from IIT Roorkee. He then pursued postdoc-
toral research at the Institute of Sound and Vibration Research (ISVR), University
of Southampton, U.K. and at the Faculty of Engineering and Computer Science,
Concordia University, Canada. He has authored about 14 books and published
more than 314 research papers in respected journals and conferences.
Professor Chakraverty is on the editorial boards of various international journals,
book series and conferences and is also the chief editor of the International Journal
of Fuzzy Computation and Modelling (IJFCM), Inderscience Publisher,
Switzerland and is a guest editor for various other journals. He is recipient of few
prestigious awards viz. Indian National Science Acdemy (INSA) nomination under
International Collaboration/Bilateral Exchange Program (with Czech Republic),
Platinum Jubilee ISCA Lecture Award (2014), CSIR Young Scientist (1997),
BOYSCAST (DST), UCOST Young Scientist (2007, 2008), Golden Jubilee
Director’s (CBRI) Award (2001), Roorkee University Gold Medals (1987, 1988)
for first positions in M. Sc. and M. Phil. etc. His current research areas include soft
computing and machine intelligence, artificial neural networks, fuzzy and interval
computations, numerical analysis, differential equations, mathematical modelling,
uncertainty modelling, vibration and inverse vibration problems.

Dr. Deepti Moyi Sahoo is currently an Assistant Professsor at O.P. Jindal


University, Punjipathra, Raigarh, Chhattisgarh in the Department of Mathematics.
She completed her Master of Science degree in Mathematics at National Institute of
Technology, in 2010. She received her Ph.D. from the same institute in 2017.
Dr. Sahoo has co-authored good number of research papers and a book chapter.
Her current research areas include interval analysis, fuzzy set theory, artificial
neural networks, interval and fuzzy neural networks, functional link neural net-
works and structural system identification problems.

xv
xvi About the Authors

Nisha Rani Mahato is currently pursuing her Ph.D. at the Department of


Mathematics at the National Institute of Technology, Rourkela, Odisha. She
completed her Master of Science degree in Mathematics at the National Institute of
Technology, in 2011. She was awarded Raman Charpak Fellowship-2016
(RCF-2016) by CEFIPRA, New Delhi. Also, she had been awarded best paper at
the 38th Annual Conference of Orissa Mathematical Society in 2011 and best poster
in mathematics at Research Scholar Week 2018, NIT Rourkela.
She has participated in various conferences/workshops and published good
number of research papers, a book chapter and a book. Her current research areas
include interval analysis, fuzzy set theory, interval/fuzzy eigenvalue problems,
interval/fuzzy simultaneous equations and interval/fuzzy differential equations.
Introduction: Soft Computing

In recent decades, artificial intelligence (AI) is gaining popularity due to its


applications in different complex problems. Various disciplines having scientific
and technological applications, viz. computer science, mathematics, control theory,
structural engineering, medical, psychology, etc., use AI to obtain rigorous results
which may not be solved by traditional methods. AI forms the branch that deals
with computational developments comparative to human reasoning, analysis,
intelligence, learning, imprecision, and multitasking. Soft computing (SC) forms a
subdiscipline of AI that is efficient for complex problems with decision making,
partial truth, imprecision, and uncertainty. In this regard, this chapter has been
dedicated just to have a firsthand overview of soft computing.
Generally, computing deals with the systematic study of methodology, process,
or algorithms that may be used to serve a definite goal. Computing may be cate-
gorized in terms of hard and soft computing. Hard computing (HC) resembles the
conventional rigorous computation dealing with certainty and precision. But, HC
may be used only in case of ideal practical problems that deal with certainty. Due to
the complex behavior of the systems, the real-world problems often include
imprecision. As such, a brief introduction to SC has been presented in the next
section.

1 Introduction

The definition of SC as stated in Zadeh et al. (1996) is given as follows:


Soft computing is a collection of methodologies that aim to exploit the tolerance for
imprecision and uncertainty to achieve tractability, robustness, and low solution cost. Its
principal constituents are fizzy logic, neuro-computing, and probabilistic reasoning. The
role model for soft computing is the human mind.
Lofti A. Zadeh

xvii
xviii Introduction: Soft Computing

Fig. 1 Principal constituents


of soft computing

As mentioned in the definition, SC comprises techniques which are inspired with


respect to human reasoning and have the potential in handling imprecision,
vagueness, and uncertainty. Various science and engineering disciplines where soft
computing techniques play an important role are data mining, aerospace, automo-
tive, electronics, robotics, marine, industrial, medical, business, defense, etc.
This chapter is mainly dedicated to incorporate the introductory idea of SC and a
brief explanation of its principal constituents. Readers interested for further
knowledge in SC and the various constituents are encouraged to refer Zadeh et al.
(1996), Kecman (2001), Tettamanzi and Tomassini (2013), Sivanandam and Deepa
(2012), Fortuna et al. (2012), and the references mentioned therein.
The principal constituents of SC as given in Fig. 1 include techniques focusing
on fuzzy system, evolutionary computation, machine learning, and probabilistic
reasoning.
Sections 2–5 provide a brief introduction to each of the principal constituents
depicted in Fig. 1.

2 Fuzzy System

Fuzzy systems deal with systems induced with imprecision. Fuzzy set theory forms
the core in handling fuzzy control systems. In this regard, the next section discusses
briefly the emergence of fuzzy set theory.

2.1 Fuzzy Set Theory

The concept of fuzzy set theory was introduced in 1965 by Lotfi A. Zadeh. Fuzzy
set theory emerged as a generalization of the crisp or classical set theory. The crisp
set deals with precision and accuracy, whereas fuzzy set deals with imprecision.
Introduction: Soft Computing xix

There exist several books focusing on fuzzy set theory and its wide range of
applications in various science and engineering problems. Interested readers may
refer the book comprising selected papers of L. A. Zadeh by Zadeh et al. (1996).
Zimmerman (2001) serves as an excellent book comprising detailed discussion of
fuzzy set theory and its applications. Other books, viz. Klir and Yuan (1995), Lee
(2006), Tettamanzi and Tomassini (2013), and the references therein, are encour-
aged for reference.
Chapters 2–7 in the present book have been dedicated to fuzzy set theory along
with C/MATLAB programming with respect to ease understanding and simplified
example problems. Chapter 3 includes discussions related to fuzzy numbers and its
arithmetic. Fuzzy arithmetic has proven itself as an efficient tool in handling
imprecise science and engineering systems. Hanss (2005) studied fuzzy arithmetic
as an extension of interval arithmetic and its applications in mechanical engineer-
ing. Real-world problems dealing with imprecise systems are often governed by
fuzzy differential equations. In this regard, Chakraverty et al. (2016) studied fuzzy
differential equations and its various applications. A detailed discussion on fuzzy
differential equations and inclusions was introduced by Lakshmikantham and
Mohapatra (2004). Readers may refer Chakraverty and Perera (2018) for various
fuzzy application problems, viz. robot localization, invasive alien species, air
quality quantification, radon diffusion, shallow water wave equations, and structural
problems.

2.2 Fuzzy Logic

Fuzzy set theory led to the emergence of multivalued logic referred as fuzzy logic
that serves as a superset of conventional Boolean logic. Generally, Boolean logic is
a binary-valued logic dealing with either 0 or 1 (No or Yes). It may be easily
associated with the crisp set having characteristic values 0 or 1. But, Boolean logic
fails to accomplish human reasoning, which led to the generalized logic, viz. fuzzy
logic. Readers may refer books, viz. Zadeh et al. (1996), Zimmerman (2001), Klir
and Yuan (1995), etc., to have a better interpretation of fuzzy logic.
In today’s world, fuzzy logic finds its usage in almost various new trending
technologies. Gradually, fuzzy logic-based washing machines, temperature con-
trollers, etc., have also gained popularity.

3 Machine Learning

Learning is termed as the acquisition of new knowledge and developments in order


to incorporate and enhance cognitive skills. Machine learning (ML) on the other
hand refers to the learning process related to computer knowledge, developments,
and modeling. ML deals with task-oriented studies, cognitive simulation, and
xx Introduction: Soft Computing

theoretical analysis as mentioned in Michalski et al. (2013). Various areas having


ML applications are cognitive learning, big data analysis, risk management, image
recognition, speech recognition, medical diagnosis, mathematics, robotics, etc. The
learning techniques or algorithms in ML are generally categorized in terms of three
classes, viz.
• Supervised learning technique,
• Unsupervised learning technique,
• Reinforced learning technique.
Readers may refer the books, viz. Kecman (2001) and Michalski et al. (2013),
for detailed concepts and preliminaries of machine learning. There exist various
machine learning algorithms, viz. neural networks, support vector machines,
genetic algorithms, and Bayesian networks. But, for the sake of completeness, we
have focused mainly on ANN. In this regard, a brief introduction to neural network
has been incorporated in the next section.

3.1 Neural Network

Neural network is a paradigm that has been inspired from the design and func-
tioning of biological nervous system of human brain, especially neurons. Neurons
provide the ability to think, judge, and recapitulate from past experiences with
respect to every reaction. For instance, if an infant mistakenly touches fire or hot
surface, then the brain stimulates the infant to remember and be aware of the same
situation. Similarly, neural network helps in performing various other tasks by
analyzing with respect to the previous records or experiences. Neural network may
also be referred as an electrochemical pathway for the transmission of information
similar to neurons. Due to this, it is often referred as artificial neural network
(ANN).
As such, ANN may be considered as an information-processing model similar to
human brain which comprises interconnected elements referred as nodes or neu-
rons. Rabuñal (2005) gave applications for music, astronomy, etc., based on ANN.
ANN has been used by Chakraverty and Mall (2017) to obtain solutions of dif-
ferential equations occurring in various fields of science and engineering. Readers
are also encouraged to refer Chaps. 10–14 for a better understanding of ANN.

4 Evolutionary Computation

Computation comprising hybrid techniques inspired from the biological world that
replicates the evolution behavior and genetic inheritance of living species is referred
Introduction: Soft Computing xxi

as evolutionary computation (EC). The key techniques helpful in implementation of


EC are:
• Evolutionary algorithms and strategies,
• Evolutionary programming,
• Differential evolution,
• Genetic algorithms and programming.
Readers are encouraged to refer Bäck et al. (1997, 2000), De Jong (2006), and
Larrañaga and Lozano (2001) to have a thorough idea on EC.

5 Probabilistic Reasoning

Probabilistic reasoning deals with handling randomness, imprecision control, and


uncertainties. Due to this feature, probabilistic reasoning is also often included in
SC techniques.
Among the above SC techniques, the present book covers in particular fuzzy set
theory concept for uncertainty handling and neural network learning techniques
along with programs so that the readers may very well learn these two concepts. As
such, in subsequent chapters we have focused on the two main concepts of soft
computing, viz. fuzzy set theory and ANN.

References

T. Bäck, D.B. Fogel, Z. Michalewicz, Handbook of evolutionary computation (CRC Press, 1997)
T. Bäck, D.B. Fogel, Z. Michalewicz, Evolutionary computation 1: Basic algorithms and
operators, 1 (CRC Press, 2000)
S. Chakraverty, S. Mall, Artificial neural networks for engineers and scientists: Solving ordinary
differential equations (CRC Press, 2017)
S. Chakraverty, S. Perera, Recent advances in applications of computational and fuzzy
mathematics (Springer, 2018)
S. Chakraverty, S. Tapaswini, D. Behera, Fuzzy differential equations and applications for
engineers and scientists (CRC Press, 2016)
K.A. De Jong, Evolutionary computation: a unified approach (MIT Press, 2006)
L. Fortuna, G. Rizzotto, M. Lavorgna, G. Nunnari, M.G. Xibilia, R. Caponetto, Soft computing:
New trends and applications (Springer Science and Business Media, 2012)
M. Hanss, Applied fuzzy arithmetic (Springer-Verlag, Berlin Heidelberg, 2005)
V. Kecman, Learning and soft computing: Support vector machines, neural networks, and fuzzy
logic models (MIT Press, 2001)
G.J. Klir, B. Yuan, Fuzzy sets and fuzzy logic, 4 (Prentice Hall, New Jersey, 1995)
V. Lakshmikantham, R.N. Mohapatra, Theory of fuzzy differential equations and inclusions (CRC
Press, 2004)
P. Larrañaga, J.A. Lozano, Estimation of distribution algorithms: A new tool for evolutionary
computation, 2 (Springer Science and Business Media, 2001)
K.H. Lee, First course on fuzzy theory and applications (Springer, New York, 2006)
xxii Introduction: Soft Computing

R.S. Michalski, J.G. Carbonell, T.M. Mitchell, Machine learning: An artificial intelligence
approach (Springer Science and Business Media, 2013)
J.R. Rabuñal, Artificial neural networks in real-life applications (IGI Global, 2005)
S.N. Sivanandam, S.N. Deepa, Principles of soft computing (Wiley India Pvt. Ltd., New Delhi,
2012)
A. Tettamanzi, M. Tomassini, Soft computing: Integrating evolutionary, neural and fuzzy systems
(Springer Science and Business Media, 2013)
L.A. Zadeh, G.J. Klir, B. Yuan, Fuzzy sets, fuzzy logic, and fuzzy systems: Selected papers, 6
(World Scientific, 1996)
H.J. Zimmerman, Fuzzy set theory and its applications (Springer, New York, 2001)
Part I
Fuzzy Set Theory
Chapter 1
Intervals

The basics of Soft Computing (SC) have been discussed in this chapter. Moreover,
this book mainly focuses on the two major SC techniques, viz., fuzzy set theory and
artificial neural network, that are discussed in subsequent chapters. In case of fuzzy
sets, fuzzy number gets converted to interval form using α-cut as given in Chap. 3.
As such, preliminaries related to intervals and interval matrices have been discussed
in this chapter. The chapter also includes arithmetic operations for intervals and
interval matrices. Further, the classical interval arithmetic has also been explained
in this chapter along with corresponding C and MATLAB codes.

1.1 Preliminaries of Intervals

An interval [a] = [a, ā] given in Fig.


 1.1 is considered as a subset of real number
system  such that [a] = [a, ā] = t|a ≤ t ≤ ā, a, ā ∈  , where a and ā are the
lower and upper bounds of the interval.
Generally, there exist different types of intervals such as open interval (a, ā) and
half open–closed interval (a, ā] or [a, ā), but for computational point of view this
chapter focusses only on closed intervals [a, ā] of . It is worth mentioning that for
simplicity, we have referred “closed interval” as “interval” throughout the book.
Let us now incorporate the basic terminologies, viz., interval center, width, and
radius associated with an interval.
Interval center: The center of an interval [a] = [a, ā] is referred as interval
center a c , which is written as

Fig. 1.1 Interval


[a] = [a, ā] (closed interval
of real line )

© Springer Nature Singapore Pte Ltd. 2019 3


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_1
4 1 Intervals

Fig. 1.2 Center a c , width


a w , and radius a  of an
interval [a, ā]

a + ā
ac = .
2
Interval width: The interval width is referred as the distance between the lower
and upper bounds of an interval [a] = [a, ā], that is

a w = ā − a.

Interval radius: Half of an interval width is referred as interval radius, that is

ā − a
a = .
2
In terms of interval center and radius, an interval [a] may be written as [a] =
[a, ā] = [a c − a  , a c + a  ]. As such, the pictorial representations of interval center,
radius, and width have been provided in Fig. 1.2.
Similar to the arithmetic operation of addition, subtraction, multiplication, and
division for any two real numbers x, y ∈ , interval arithmetic operations have been
defined in Moore et al. (2009). The classical interval arithmetic operations in terms
of the binary operations, viz., addition, subtraction, multiplication, and division, are
discussed below:
Interval arithmetic: If [a] = [a, ā] and [b] = [b, b̄] be two intervals, then the
classical arithmetic operations for the two intervals are written as
Addition:

[a] + [b] = [a + b, ā + b̄], (1.1)

Subtraction:

[a] − [b] = [a − b̄, ā − b], (1.2)


1.1 Preliminaries of Intervals 5

Multiplication:
    
[a] · [b] = min a · a, a · b̄, ā · b, ā · b̄ , max a · a, a · b̄, ā · b, ā · b̄ , (1.3)

Division:
  
[a] a ā
, , 0∈
/ [b]
= b̄ b . (1.4)
[b] (−∞, ∞), 0 ∈ [b]

1.1.1 Addition and Subtraction of Intervals

This section is devoted to perform the addition and subtraction operations given
in Eqs. (1.1) and (1.2). In this regard, we have considered an example problem in
Example 1.1.

Example 1.1 Consider two intervals [a] = [−8, 9] and [b] = [−4, 7]. Then,
compute the interval addition and subtraction of the two intervals.

Solution: The addition operation using Eq. (1.1) is performed as

[a] + [b] = [−8 + 4, 9 + 7] = [−4, 16]

and the subtraction operation using Eq. (1.2) is obtained as

[a] − [b] = [−8 − 7, 9 − (−4)] = [−15, 13].

The corresponding program for addition and subtraction of two intervals is


included using C programming in Program 1.1.

Program 1.1: Write a C program for computing addition and subtraction of two
intervals.
//Addition and subtraction of two intervals
#include<stdio.h>
#include<conio.h>
int main()
{
float al,au,bl,bu,cl,cu,dl,du;
printf("Enter the lower (al) and upper (au) limit of first interval:\n");
scanf("%f%f",&al,&au);
printf("Enter the lower (bl) and upper (bu) limit of second interval:\n");
6 1 Intervals

scanf("%f%f",&bl,&bu);
//Addition of two intervals
cl=al+bl;
cu=au+bu;
printf("The addition of two intervals [%f,%f] + [%f,%f] is:\n[%f,%f]\n",
al,au,bl,bu,cl,cu);
//Subtraction of two intervals
dl=al-bu;
du=au-bl;
printf("The subtraction of two intervals [%f,%f] - [%f,%f] is:\n[%f,%f]\n",
al,au,bl,bu,dl,du);
getch();
return 0;
}

The same results of Example 1.1 have been obtained using Program 1.1 by con-
sidering the interval bounds [a] = [−8, 9] and [b] = [−4, 7].

Input:
Enter the lower (al) and upper (au) limit of first interval:
-8 9
Enter the lower (bl) and upper (bu) limit of second interval:
-4 7

Output:
The addition of two intervals [-8.000000,9.000000] + [4.000000,7.000000] is:
[-4.000000,16.000000]
The subtraction of two intervals [-8.000000,9.000000] - [4.000000,7.000000] is:
[-15.000000,13.000000]

Accordingly, the output window for solving Example 1.1 using Program 1.1 has
been depicted in Fig. 1.3.
Next section presents the binary operation, viz., multiplication of intervals.

Fig. 1.3 Output of addition and subtraction of two intervals


1.1 Preliminaries of Intervals 7

1.1.2 Multiplication of Intervals

Multiplication of intervals is performed using Eq. (1.3) and an example problem is


considered in Example 1.2 for computing the interval multiplication.
Example 1.2 Consider two intervals [a] = [−8, 9] and [b] = [4, 7], and then
compute multiplication of the two intervals.
Solution: Using Eq. (1.3) of multiplication, we obtain

[a] · [b] = [min{−32, −56, 36, 63}, max{−32, −56, 36, 63}] = [−56, 63].

The program for multiplication of intervals in C language has been discussed in


Program 1.2.
Program 1.2: Compute multiplication of two given intervals using C programming.

//Multiplication of two intervals


#include<stdio.h>
#include<conio.h>
int main()
{
int i;
float al,au,bl,bu,ml,mu,a[5];
printf("Enter the lower (al) and upper (au) limit of first interval:\n");
scanf("%f%f",&al,&au);
printf("Enter the lower (bl) and upper (bu) limit of second interval:\n");
scanf("%f%f",&bl,&bu);
a[1]=al*bl;
a[2]=al*bu;
a[3]=au*bl;
a[4]=au*bu;
ml=a[1];
mu=a[1];
for(i=2;i<=4;i++)
{
if(ml>a[i])
ml=a[i];
if(mu<a[i])
mu=a[i];
}
printf("The multiplication of two intervals [%f,%f] x [%f,%f]
is:\n[%f,%f]", al,au,bl,bu,ml,mu);
getch();
return 0;
}
Let us execute the above program for solving Example 1.2 by considering the
following input.
8 1 Intervals

Fig. 1.4 Output of multiplication of two intervals

Input:
Enter the lower (al) and upper (au) limit of first interval:
-8 9
Enter the lower (bl) and upper (bu) limit of second interval:
-4 7

Output:
The multiplication of two intervals [-8.000000,9.000000] x [4.000000,7.000000] is:
[-56.000000,63.000000]

Further, the output window for solving Example 1.1 using Program 1.1 has been
depicted in Fig. 1.4.

1.1.3 Division and Inverse of Intervals

In this section, division of two intervals based on Eq. (1.4) has been considered with
respect to an example problem given in Example 1.3.
[a]
Example 1.3 Compute the value of [b]
for two intervals [a] = [−8, 9] and [b] =
[4, 7].

Solution: Using Eq. (1.4), we get


[a] 8 9
= − , = [−1.142857, 2.25].
[b] 7 4

Then, the program for computation of division of two intervals has been incorpo-
rated in Program 1.3.
1.1 Preliminaries of Intervals 9

Program 1.3: Write a C program for computing division of two intervals.

//Division of two intervals


#include<stdio.h>
#include<conio.h>
int main()
{
int i;
float al,au,bl,bu,dl,du,a[5];
printf("Enter the first interval [al,au]:\n");
scanf("%f%f",&al,&au);
printf("Enter the second interval [bl,bu] such that zero doesnot belong to
[bl,bu]:\n");
scanf("%f%f",&bl,&bu);
if(bl<=0 && bu>=0)
printf("The division of two intervals [%f,%f] / [%f,%f] is:\n (-
inf,inf)\n",al,au,bl,bu);
else
{
a[1]=al/bu;
a[2]=au/bl;
dl=a[1];
du=a[2];
printf("\nThe division of two intervals [%f,%f] / [%f,%f] is:\n
[%f,%f]\n",al,au,bl,bu,dl,du);
}
getch();
return 0;
}
Accordingly, the above program has been executed for solving Example 1.3.

Input:
Enter the first interval [al,au]:
-8 9
Enter the second interval [bl,bu] such that zero doesnot belong to [bl,bu]:
47

Output:
The division of two intervals [-8.000000,9.000000] / [4.000000,7.000000] is:
[-1.142857,2.250000]

Then, the associated output window for Program 1.3 with respect to Example 1.3
has been given in Fig. 1.5.
Then, the additive and multiplicative inverse of interval have been defined below.
Inverse: Additive inverse of an interval [a] = [a, ā] may be defined as
10 1 Intervals

Fig. 1.5 Output of division of two intervals

−[a] = (−1) · [a, ā] = [−ā, −a] (1.5)

and the multiplicative inverse of an interval [a] = [a, ā] may be defined as
  
1 ,
1 1
, 0∈ / [a]
[a]−1 = = ā a . (1.6)
[a, ā] (−∞, ∞), 0 ∈ [a]

The C program with respect to computation of multiplicative inverse is illustrated


by Program 1.4. Similarly, the C program for computation of additive inverse may
be written which is left to the reader.

Program 1.4: Write a C program for computing multiplicative inverse of a given


interval.
//Multiplicative inverse of an interval
#include<stdio.h>
#include<conio.h>
int main()
{
float al,au,il,iu;
printf("Enter an interval [al,au]:\n");
scanf("%f%f",&al,&au);
if(al<=0 && au>=0)
printf("The inverse of an interval [%f,%f] is:\n (-inf,inf)\n");
else
{
il=1/au;
iu=1/al;
printf("The inverse of an interval [%f,%f]
is:\n[%f,%f]\n",al,au,il,iu);
}
getch();
return 0;
}

Using Program 1.4, Example 1.3 has been solved using the following input to
obtain the multiplicative inverse of a given interval.
1.1 Preliminaries of Intervals 11

Fig. 1.6 Multiplicative inverse of an interval

Input:
Enter the first interval [al,au]:
-8 9

Output:
The inverse of an interval [8.000000,9.000000] is:
[0.111111,0.125000]

Then, the corresponding output window for execution of Program 1.4 associated
with Example 1.3 has been illustrated in Fig. 1.6.
Accordingly, the basic interval arithmetic operations discussed in Sects.
1.1.1–1.1.3 are computed with respect to MATLAB codes in Program 1.5.

Program 1.5: Write a MATLAB program to compute addition, subtraction, multi-


plication, division, and inverse of given intervals.

%Arithmetic operations on intervals


% Enter the two intervals
al = input('Enter the lower bound of interval [a]: ');
au = input('Enter the upper bound of interval [a]: ');
bl = input('Enter the lower bound of interval [b]: ');
bu = input('Enter the upper bound of interval [b]: ');
%Addition of [a] and [b]
disp('The addition of two intervals is:');
suml=al+bl
sumu=au+bu
%Subtraction of [a] and [b]
disp('The subtraction of two intervals is:');
diffl=al-bu
diffu=au-bl
%Multiplication of [a] and [b]
disp('The multiplication of two intervals is:');
mul=min([al*bl,al*bu,au*bl,au*bu])
muu=max([al*bl,al*bu,au*bl,au*bu])
%Division of [a] and [c] such that 0 does not belong to [c]
cl = input('Enter the lower bound of interval [c]: ');
cu = input('Enter the upper bound of interval [c]: ');
disp('The division of two intervals [a] and [c] is:');
12 1 Intervals

if(cl<=0 && cu>=0)


disp( 'The division of [a]/[c] is:(-inf,inf)');
else
disp( 'The division of [a]/[c] is:');
divl=al/cu
divu=au/cl
end
%Additive inverse of an interval
disp( 'The additive inverse of an interval c=[cl,cu] is:');
ail=-cu
aiu=-cl
%Multiplicative inverse of an interval
disp( 'The multiplicative inverse of an interval c=[cl,cu] is:');
if(cl<=0 && cu>=0)
disp( '[-inf,inf]');
else
mil=1/cu
miu=1/cl
end

Using Program 1.5, Example 1.3 has been computed to obtain the addition, sub-
traction, multiplication, and division of given intervals.

Input:
Enter the lower bound of interval a: -8
Enter the upper bound of interval a: 9
Enter the lower bound of interval b: -4
Enter the upper bound of interval b: 7
Enter the lower bound of interval c: 4
Enter the upper bound of interval c: 7

Output:
The addition of two intervals is:
suml = -12
sumu =16
The subtraction of two intervals is:
diffl =-15
diffu = 13
The multiplication of two intervals is:
mul = -56
muu = 63
The division of two intervals a and c is:
divl = 1.1429
divu = 2.25
1.1 Preliminaries of Intervals 13

The additive inverse of an interval c=[cl,cu] is:


ail = -9
aiu = 8
The multiplicative inverse of an interval c=[cl,cu] is:
mil = 0.1429
miu = 0.25

Next section extends the basic terminologies and arithmetic operations related
with intervals to interval matrices.

1.2 Interval Matrices

An interval matrix is a matrix having each element as an interval. A m × n interval


matrix [A] = ([ai j ]) for i = 1, 2, . . . , m; j = 1, 2, . . . , n is written as
⎛ ⎞
a11 a21 · · · a1n
⎜ a21 a22 ⎟
⎜ ⎟
[A] = [A, A] = ⎜ . . ⎟,
⎝ .. .. ⎠
am1 am2 · · · amn
⎛ ⎞ ⎛ ⎞
a 11 a 12 · · · a 1n ā11 ā12 · · · ā1n
⎜a a ⎟ ⎜ ā21 ā22 ⎟
⎜ 21 22 ⎟ ⎜ ⎟
where A = ⎜ . .. ⎟ and A = ⎜ . .. ⎟ are, respectively,
⎝ .. . ⎠ ⎝ .. . ⎠
a m1 a m2 · · · a mn ām1 ām2 · · · āmn
the lower and upper bounds of the interval matrix [A]. Then, the corresponding
center, width, and radius matrices of the interval matrix are defined below.
Center matrix: Center matrix is the matrix consisting of interval centers with
respect to each element [ai j ] as
⎛ c ⎞
c
a11 c
a12 · · · a1n
⎜ ac ac ⎟
⎜ 21 22 ⎟
Ac = ⎜ . .. ⎟. (1.7)
⎝ .. . ⎠
am1 am2 · · · amn
c c c

Width matrix: Width matrix is the matrix consisting of width with respect to
each element [ai j ] as
14 1 Intervals
⎛ w ⎞
w
a11 w
a12 · · · a1n
⎜ aw aw ⎟
⎜ 21 22 ⎟
Aw = ⎜ . . ⎟. (1.8)
⎝ .. .. ⎠
am1 am2 · · · amn
w w w

Radius matrix: Radius matrix is the matrix consisting of radius of each element
[ai j ] as
⎛    ⎞
a11 a12 · · · a1n
⎜ a a ⎟
⎜ 21 22 ⎟
A = ⎜ . .. ⎟. (1.9)
⎝ .. . ⎠
  
am1 am2 · · · amn

Similar to intervals, an interval matrix [A] in terms of its center and radius matrices
may be expressed as [A] = [Ac − A , Ac + A ]. Using Eqs. (1.7) to (1.9), an interval
matrix
⎛ ⎞
[−8, −1] [3, 6] [2, 4] [−6, −4]
⎜ [3, 6] [−4, −1] [3, 7] [0, 5] ⎟
[A] = ⎜
⎝ [2, 4]

[3, 7] [2, 4] [−4, −2] ⎠
[−6, −4] [0, 5] [−4, −2] [−6, −2]

has the center, width, and radius matrices, respectively, as


⎛ ⎞ ⎛ ⎞ ⎛ ⎞
−4.5 4.5 3 −5 7322 3.5 1.5 1 1
⎜ 4.5 −2.5 5 2.5 ⎟ ⎜ 3 3 4 5 ⎟ ⎜ 2.5 ⎟
Ac = ⎜ ⎟, Aw = ⎜ ⎟  ⎜ 1.5 1.5 2 ⎟.
⎝ 3 5 3 −3 ⎠ ⎝ 2 4 2 2 ⎠, and A = ⎝ 1 2 1 1 ⎠
−5 2.5 −3 −4 2524 1 2.5 1 2

Based on Eqs. (1.7)–(1.9), the C and MATLAB programs for computation of


center, width, and radius matrices have been illustrated in Programs 1.6 and 1.7,
respectively.
1.2 Interval Matrices 15

Program 1.6: Write a C program for computing center, width, and radius matrices
of a given interval matrix.

//Computing center, width and radius matrices


#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,m,n;
float Al[10][10],Au[10][10],Ac[10][10],Aw[10][10],Ad[10][10];
printf("Enter the number of rows and columns in interval matrices [A]\n");
scanf("%d%d",&m,&n);
printf("Enter the lower (Al) bound of the interval matrix [A]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&Al[i][j]);
}
}
printf("Enter the upper (Au) bound of the interval matrix [A]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&Au[i][j]);
}
}
printf("The center matrix Ac for the interval matrix [A] is:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
Ac[i][j]=(Al[i][j]+Au[i][j])/2;
printf("%f\t",Ac[i][j]);
}
printf("\n");
}
printf("The width matrix Aw for the interval matrix [A] is:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
Aw[i][j]=(Au[i][j]-Al[i][j]);
printf("%f\t",Aw[i][j]);
}
printf("\n");
}
16 1 Intervals

printf("The radius matrix Ad for the interval matrix [A] is:\n");


for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
Ad[i][j]=(Au[i][j]-Al[i][j])/2;
printf("%f\t",Ad[i][j]);
}
printf("\n");
}
getch();
}

The above program has been then executed to obtain the center, width, and radius
of a given interval matrix as follows.

Input:
Enter the number of rows and columns in interval matrix [A]
33
Enter the lower (Al) bound of the interval matrix [A]:
-10 3 8
-7 0 -8
4 7 -7
Enter the upper (Au) bound of the interval matrix [A]:
-8 5 10
-5 2 -6
6 9 -5

Output:
The center matrix Ac for the interval matrix [A] is:
-9.000000 4.000000 9.000000
-6.000000 1.000000 -7.000000
5.000000 8.000000 -6.000000
The width matrix Aw for the interval matrix [A] is:
2.000000 2.000000 2.000000
2.000000 2.000000 2.000000
2.000000 2.000000 2.000000
The radius matrix Ad for the interval matrix [A] is:
1.000000 1.000000 1.000000
1.000000 1.000000 1.000000
1.000000 1.000000 1.000000

The obtained output window is accordingly depicted in Fig. 1.7.


Corresponding center, width, and radius matrices associated with interval matrix
have been computed using MATLAB codes in Program 1.7.
1.2 Interval Matrices 17

Fig. 1.7 Output of center, width, and radius matrices of an interval matrix

Program 1.7: Write a MATLAB program for computing center, width, and radius
matrices of a given interval matrix.

%Computing center, width and radius matrices


% Enter the lower and upper bound of interval matricx A
Al = input('Enter the lower bound of interval matrix A:');
Au = input('Enter the upper bound of interval matrix A:');
%Center
disp('The center matrix Ac for the interval matrix A is:');
Ac=(Al+Au)/2
%Width
disp('The width matrix Aw for the interval matrix A is:');
Aw=Au-Al
%Radius
disp( 'The radius matrix Ad for the interval matrix A is:');
Ad=(Au-Al)/2

Using the MATLAB codes given in Program 1.7, the center, width, and radius of
a given interval matrix are obtained.

Input:
Enter the lower bound of interval matrix A:[-10 3 8;-7 0 -8;4 7 -7]
Enter the upper bound of interval matrix A:[-8 5 10;-5 2 -6;6 9 -5]

Output:
The center matrix Ac for the interval matrix A is:
Ac = -9 4 9
-6 1 -7
5 8 -6
18 1 Intervals

The width matrix Aw for the interval matrix A is:


Aw = 2 2 2
2 2 2
2 2 2

The radius matrix Ad for the interval matrix A is:


Ad = 1 1 1
1 1 1
1 1 1

Further, the arithmetic operations in case of interval matrices have been discussed
in detail in Sect. 1.2.1.

1.2.1 Arithmetic Operations on Interval Matrices

Interval matrix arithmetic: If [A] = [A, A] and [B] = [B, B] be two intervals,
then the arithmetic operations for intervals may be written as follows:
Addition:

[A] + [B] = [A + B, A + B]. (1.10)

Subtraction:

[A] − [B] = [A − B, A − B]. (1.11)

Based on Eqs. (1.10) and (1.11), corresponding C and MATLAB programs have
been incorporated in Programs 1.8 and 1.9, respectively.

Program 1.8: Compute addition and subtraction of two given interval matrices
using C programming.

//Addition and subtraction of two interval matrices


#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,m,n;
float Al[10][10], Au[10][10], Bl[10][10], Bu[10][10], Cl[10][10],
Cu[10][10], Dl[10][10], Du[10][10];
printf("Enter the number of rows and columns in interval matrices [A] and
[B]\n");
1.2 Interval Matrices 19

scanf("%d%d",&m,&n);
printf("Enter the lower (Al) bound of first interval matrix [A]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&Al[i][j]);
}
}
printf("Enter the upper (Au) bound of first interval matrix [A]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&Au[i][j]);
}
}
printf("Enter the lower (Bl) bound of second interval matrix [B]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&Bl[i][j]);
}
}
printf("Enter the upper (Bu) bound of second interval matrix [B]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&Bu[i][j]);
}
}
//Addition of interval matrices
printf("The addition of two interval matrices [A] and [B] is
[C]=[A]+[B]:\n");
for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
Cl[i][j]=Al[i][j]+Bl[i][j];
Cu[i][j]=Au[i][j]+Bu[i][j];
printf("[%f,%f]\t",Cl[i][j],Cu[i][j]);
}
printf("\n");
}
//Subtraction of interval matrices
printf("The subtraction of the interval matrix [B] from [A] is [D]=[A]-
[B]\n");
20 1 Intervals

for (i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
Dl[i][j]=Al[i][j]-Bu[i][j];
Du[i][j]=Au[i][j]-Bl[i][j];
printf("[%f,%f]\t",Dl[i][j],Du[i][j]);
}
printf("\n");
}
getch();
return 0;
}

Then, the above MATLAB codes have been executed to compute the addition and
subtraction of two interval matrices as given below.

Input:
Enter the number of rows and columns in interval matrices [A] and [B]
22
Enter the lower (Al) bound of first interval matrix [A]:
45
64
Enter the upper (Au) bound of first interval matrix [A]:
68
75
Enter the lower (Bl) bound of second interval matrix [B]:
2 -2
-1 2
Enter the upper (Bu) bound of second interval matrix [B]:
41
14

Output:
The addition of two interval matrices [A] and [B] is [C]=[A]+[B]:
[6.000000,10.000000] [3.000000,9.000000]
[5.000000,9.000000] [6.000000,9.000000]
The subtraction of the interval matrix [B] from [A] is [D]=[A]-[B]
[0.000000,4.000000] [4.000000,10.000000]
[4.000000,8.000000] [0.000000,3.000000]

The corresponding output window for Program 1.8 has been depicted in Fig. 1.8.
1.2 Interval Matrices 21

Fig. 1.8 Output of addition and subtraction for two interval matrices

Program 1.9: Write a MATLAB program for computing addition and subtraction
for given interval matrices.

%Addition and subtraction of two interval matrices


% Enter the lower and upper bound of interval matrices [A] and [B]
Al = input('Enter the lower bound of interval matrix [A]: ');
Au = input('Enter the upper bound of interval matrix [A]: ');
Bl = input('Enter the lower bound of interval matrix [B]: ');
Bu = input('Enter the upper bound of interval matrix [B]: ');
%Addition of A and B
disp('The addition of two intervals is matrix [C]');
% Cl and Cu are the lower and upper bounds of matrix C obtained after addition of
[A] and [B]
disp('The lower bound of Cl and upper bound of Cu are obtained as:');
Cl=Al+Bl
Cu=Au+Bu
%Subtraction of [A] and [B]
disp('The subtraction of two interval matrices [A] and [B] is matrix [D]');
% Dl and Du are the lower and upper bounds of matrix [D] obtained after
subtraction of [B] from [A]
disp('The lower bound of Dl and upper bound of Du are obtained as:');
Dl=Al-Bu
Du=Au-Bl

Then, the addition and subtraction operations for two interval matrices have been
performed using Program 1.9.
22 1 Intervals

Input:
Enter the lower bound of interval matrix [A]: [4 5;6 4]
Enter the upper bound of interval matrix [A]: [6 8;7 5]
Enter the lower bound of interval matrix [B]: [2 -2;-1 2]
Enter the upper bound of interval matrix [B]: [4 1;2 4]

Output:
The addition of two intervals is matrix [C]
The lower bound of Cl and upper bound of Cu are obtained as:
Cl = 6 3
5 6
Cu = 10 9
9 9
The subtraction of two interval matrices [A] and [B] is matrix [D]
The lower bound of Dl and upper bound of Du are obtained as:
Dl = 0 4
4 0
Du = 4 10
8 3

The applications of interval matrices for solving interval system of linear equations
and interval eigenvalue problems are discussed later in Chaps. 8 and 9, respectively.
Moreover, few unsolved problems have been included for self-evaluation of the
readers. Also, readers are encouraged to refer Alefeld and Herzberger (1983), Hansen
(1975), Moore (1962, 1979), Moore and Lodwick (2003), Moore et al. (2009), and
the references mentioned therein for further knowledge of interval computations.
Exercise
1. Write a C or MATLAB program for finding the center, radius, and width of a
given interval [a].
2. Compute the value of ([1, 2] + [3, 8]) × [−4, 7] − ([−1, 10]/[−7, −1]) using C
program.
3. Write a C program to compute additive inverse of interval [−4, 8].
4. Write a C or MATLAB program to compute multiplication of two given interval
matrices [A] and [B] by extending the basic multiplication of intervals.

References

G. Alefeld, J. Herzberger, Introduction to Interval Computations (Academic Press, London, 1983)


E.R. Hansen, A generalized interval arithmetic, in Interval Mathematics (Springer, Berlin, Heidel-
berg, 1975), pp. 7–18
L. Jaulin, M. Kieffer, O. Didrit, E. Walter, Applied Interval Analysis: With Examples in Parameter
and State Estimation, Robust Control and Robotics, vol. 1 (Springer, London, 2001)
References 23

R.E. Moore, Interval arithmetic and automatic error analysis in digital computing, Ph. D. Disserta-
tion, Department of Mathematics, Stanford University, 1962
R.E. Moore, Methods and Applications of Interval Analysis, vol. 2 (SIAM, New Delhi, 1979)
R.E. Moore, W. Lodwick, Interval analysis and fuzzy set theory. Fuzzy Sets Syst. 135(1), 5–9 (2003)
R.E. Moore, R.B. Kearfott, M.J. Cloud, Introduction to Interval Analysis (SIAM, Philadelphia, PA,
2009)
Chapter 2
Fuzzy Sets

In this chapter, the definition and preliminaries related to crisp sets have been
extended to fuzzy sets based on its membership function. As such, preliminaries
related to fuzzy sets, its membership function, and operations of fuzzy sets have
been discussed in Sect. 2.1. Further, C and/or MATLAB programming codes have
been included for computational verification.

2.1 Preliminaries of Fuzzy Sets

Let us discuss the terminology “crisp sets” before the explanation of fuzzy sets. A
crisp set or classical set is a collection of well-defined objects from a universal set X.
Generally for a crisp set, the characteristic function considers the values {0, 1} that
is for any x ∈ X , either x ∈ A (characteristic value is 1) or x ∈ / A (characteristic
value is 0). But if the characteristic or membership function associated with the
elements belongs to a certain extent of its dependency to the respective set, then
the possibility of dependency for the elements may vary over 0–1. In such case, the
membership function for fuzzy set is advantageous over the classical characteristic
function, which is considered as a mapping from universal set X to [0, 1], that is,

μ A : X → [0, 1].

So, the fuzzy sets may be considered as vague or uncertain sets dealing with
imprecision and having membership function lying in [0, 1].
As such, the Venn diagrams of crisp and fuzzy sets have been depicted in Figs. 2.1
and 2.2, respectively.
It may be seen from the above figures that the boundary of fuzzy set is not fixed,
rather it is uncertain. In this regard, a classical definition of fuzzy set has been given.

© Springer Nature Singapore Pte Ltd. 2019 25


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_2
26 2 Fuzzy Sets

Fig. 2.1 Crisp set A

Fig. 2.2 Fuzzy set Ã

Fuzzy set: A fuzzy set à is defined in terms of ordered pairs à = {(x, μ à (x))/x ∈
X, μ Ã (x) ∈ [0, 1]}, where μ Ã (x) is the membership function of x ∈ X . Here, X
resembles the universal set.
Other than the ordered pair form à = {(x1 , μ à (x1 )), (x2 , μ à (x2 )), . . .}, where
μ Ã (xi ) are membership functions for xi ∈ X and i = 1, 2, . . ., a fuzzy set may also
be expressed in different forms such as
   
μ Ã (x1 ) μ Ã (x2 ) μ Ã (xk )
à = + + ··· = ,
x1 x2 xk

in case of discrete fuzzy set. Further, in continuous case, the fuzzy set may be
expressed as

μ Ã (x)
à = d x.
x
2.1 Preliminaries of Fuzzy Sets 27

Fig. 2.3 Real numbers


greater than 5

Example 2.1 Consider a universal set X = {2, 3, 4, 5, 6, 7, 8} as the number of seats


in vehicles and fuzzy set à resembling “suitable vehicle for a family consisting of
four members”. Obtain the ordered form notion for the given fuzzy set.

Solution: The fuzzy set associated with the universal set X = {2, 3, 4, 5, 6, 7, 8}
resembling “suitable vehicle for a family consisting of four members” may be written
in the ordered form as

à = {(2, 0), (3, 0.5), (4, 1), (5, 1), (6, 0.8), (7, 0.1), (8, 0), (9, 0), (10, 0)}.

Example 2.2 Let us consider a universal set X as real number  and a continuous
fuzzy set à as “real numbers greater than 5”. Obtain the suitable membership function
and show it graphically.

Solution: The respective membership function of à may be considered as



0 ,x ≤5
μ Ã (x) = 1
1+(x−5)−2 , x >5

and the corresponding graph is depicted in Fig. 2.3.

2.2 Generating Membership Function

This section discusses the generation of appropriate membership function μ Ã (x)


associated with a fuzzy set Ã. In this regard, an example problem has been considered
in Example 2.3.
28 2 Fuzzy Sets

Example 2.3 Consider a fuzzy set à = “real numbers close to 10”. Obtain the gen-
erating function yielding the membership function associated with Ã.

Solution: The corresponding membership function of à may be generated using

1
μ Ã (x) = .
1 + (x − 10)2

The corresponding C and MATLAB codes related to Example 2.3 for computation
of the membership values of fuzzy set à are incorporated in Programs 2.1 and 2.2,
respectively.

Program 2.1: Write a C program for generating membership function of a fuzzy


set “real numbers close to 10”.
//Generating membership function of a fuzzy set
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float x[50],mu[50],a;
int n,i;
printf("Enter the number of elements in fuzzy set A={real numbers close to
10}:\n");
scanf("%d",&n);
printf("Enter the elements x in A={(x,muA(x))}\n");
for(i=1;i<=n;i++)
{
scanf("%f",&x[i]);
}
printf("The corresponding membership values for fuzzy set A are:\n");
printf("x\t\t muA(x)\n");
for(i=1;i<=n;i++)
{
a=pow(x[i]-10,2);
mu[i]=1/(1+a);
printf("%f\t %f\n",x[i],mu[i]);
}
getch();
return 0;
}
2.2 Generating Membership Function 29

Using Program 2.1, equivalent membership values are obtained for the member-
ship function of Example 2.3 after execution.

Input:
Enter the number of elements in fuzzy set A={real numbers close to 10}:
10
Enter the elements x in A={(x,muA(x))}
2 4 6 8 10 12 14 16 18 20

Output:
The corresponding membership values for fuzzy set A are:
x muA(x)
2.000000 0.015385
4.000000 0.027027
6.000000 0.058824
8.000000 0.200000
10.000000 1.000000
12.000000 0.200000
14.000000 0.058824
16.000000 0.027027
18.000000 0.015385
20.000000 0.009901

Then, the output window of Program 2.1 has been depicted in Fig. 2.4.

Fig. 2.4 Output of generated membership values for fuzzy set “real numbers close to 10”
30 2 Fuzzy Sets

Program 2.2: A MATLAB program for generating membership function of a fuzzy


set, “real numbers close to 10”.
%Generating membership function of a fuzzy set
clear all;
clc;
disp('The membership function plot for fuzzy set is:');
x=linspace(0,20,100); %xlimit
mu = 1./(1+(x-10).^2); %membership function
plot(x,mu,'-b','Linewidth',2);
xlabel('x');
ylabel('\mu(x)');
set(gca,'Fontsize',12);

Using Program 2.2, the membership function of fuzzy set given in Example 2.3
is generated and the corresponding plot is depicted in Fig. 2.5.
The next section discusses the terminologies support, height, core, and boundary
related to fuzzy sets.

Output:
The membership function plot for fuzzy set is: given in Fig. 2.5

Fig. 2.5 MATLAB plot of fuzzy set “real numbers close to 10”
2.3 Support, Height, Core, and Boundary of Fuzzy Set 31

2.3 Support, Height, Core, and Boundary of Fuzzy Set

Support: Support of a fuzzy set is defined as the crisp collection of elements with
respect to universal set X having positive membership function, that is,

S( Ã) = {x|μ Ã (x) > 0}.

Height: Height of a fuzzy set is defined as the maximum value of membership


function:

sup μ Ã (x).
x

If the height of a fuzzy set is 1 as sup μ Ã (x) = 1, then such set is referred as
x
normalized fuzzy set.
Core: Core of a fuzzy set is the crisp collection of the elements having membership
values equal to 1, that is,

C( Ã) = {x|μ Ã (x) = 1}.

Boundary: Boundary of a fuzzy set is the crisp collection of all elements of a


fuzzy set, that is,

B( Ã) = {x|μ Ã (x) ≥ 0}.

The graphical representation of support, core, and boundary for a fuzzy set has
been depicted in Fig. 2.6.

Fig. 2.6 Support, core, and


boundary of fuzzy set Ã
32 2 Fuzzy Sets

Further, a fuzzy set à =“close to 0” having membership function μ à (x) = 1+x


1
2

has been considered for the computation of support, height, core, and boundary. The
corresponding C and MATLAB programs associated with fuzzy set à = “close to
0” have been incorporated in Programs 2.3 and 2.4, respectively.

Program 2.3: Write a C program for computing support, height, core, and boundary
of fuzzy set close to 0.

//Support, height, core and boundary of a fuzzy set


#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float max,x[10],mu[10];
int i,n;
printf("Enter the number of elements in fuzzy set A={(x,muA(x))}\n");
scanf("%d",&n);
printf("Enter the values of x\n");
for(i=1;i<=n;i++)
{
scanf("%f",&x[i]);
}
printf("The corresponding membership values muA(x) are:\n");
printf("x\t\t muA(x)\n");
for(i=1;i<=n;i++)
{
mu[i]=1/(1+pow(x[i],2));
printf("%f\t %f\n",x[i],mu[i]);
}
printf("\nSupport={");
for(i=1;i<=n;i++)
{
if(mu[i]>0)
printf("%f ",x[i]);
}
printf("}\nHeight=");
max=mu[1];
for(i=2;i<=n;i++)
{
if(max<mu[i])
max=mu[i];
}
2.3 Support, Height, Core, and Boundary of Fuzzy Set 33

printf("%f ",max);
printf("\nCore={");
for(i=1;i<=n;i++)
{
if(mu[i]==1)
printf("%f ",x[i]);
}
printf("}\nBoundary={");
for(i=1;i<=n;i++)
{
if(mu[i]>=0&&mu[i]<1)
printf("%f ",x[i]);
}
printf("}\n");
getch();
return 0;
}

The support, height, core, and boundary of the fuzzy set à = “close to 0” have
been obtained after executing Program 2.3.

Input:
Enter the number of elements in fuzzy set A={(x,muA(x))}
5
Enter the values of x
-2 -1 0 1 2
The corresponding membership values muA(x) are:
x muA(x)
-2.000000 0.200000
-1.000000 0.500000
0.000000 1.000000
1.000000 0.500000
2.000000 0.200000

Output:
Support={-2.000000 -1.000000 0.000000 1.000000 2.000000 }
Height=1.000000
Core={0.000000 }
Boundary={-2.000000 -1.000000 1.000000 2.000000 }

Further, the output window related to Program 2.3 has been depicted in Fig. 2.7.
34 2 Fuzzy Sets

Fig. 2.7 Output of support, height, core, and boundary of a fuzzy set

Accordingly, the corresponding MATLAB codes to compute support, height, core,


and boundary of a fuzzy set close to 0 are given in Program 2.4.

Program 2.4: Write a MATLAB program for computing support, height, core, and
boundary of a fuzzy set.

%Support, height, core and boundary of a fuzzy set


clear all;
clc;
x = input('Enter the x values of A\n');
n = length(x);
disp('The corresponding membership values are:')
mu = 1./(1+x.^2); %membership function
disp(mu);
%Support
disp('Support=');
for i=1:n
if(mu(i)>0)
s(i)=x(i);
end
end
disp(s);
%Height
disp('Height=')
h=max(mu);
disp(h);
%Core
disp('Core=');
j=1;
for i=1:n
if(mu(i)==1)
c(i)=x(i);
j=j+1;
end
2.3 Support, Height, Core, and Boundary of Fuzzy Set 35

end
disp(c);
%Boundary
disp('Boundary=');
k=1;
for i=1:n
if(mu(i)>=0&&mu(i)<1)
b(i)=x(i);
k=k+1;
end
end
disp(b)

The support, height, core, and boundary of fuzzy set have been obtained using
Program 2.4.

Input:
Enter the x values of A
[-2, -1, 0, 1, 2]
The corresponding membership values are:
0.2000 0.5000 1.0000 0.5000 0.2000

Output:
Support= -2 -1 0 1 2
Height= 1
Core= 0
Boundary= -2 -1 1 2

Similar to the set operations of crisp sets, the basic set operations, viz., union,
intersection, and complement, have been extended to fuzzy sets with respect to the
membership functions in the next section.

2.4 Intersection, Union, and Complement

The operations of intersection, union, and complement of crisp sets have been
extended to fuzzy sets as:
36 2 Fuzzy Sets

• Intersection: If à and B̃ are two fuzzy sets with membership functions μ à (x) and
μ B̃ (x), respectively, then intersection may be considered as C̃ = Ã ∩ B̃, where

μC̃ (x) = min(μ Ã (x), μ B̃ (x)), ∀x ∈ X.

• Union: The union of two fuzzy sets à and B̃ may be considered as C̃ = à ∪ B̃,
where

μC̃ (x) = max(μ Ã (x), μ B̃ (x)), ∀x ∈ X.

• Complement: The complement of à may be expressed as

Ãc = {(x, μ Ãc (x))|μ Ãc (x) = 1 − μ Ã (x), ∀x ∪ X }.

It may be noted that in case of crisp sets A ∪ B = X and A ∩ B = φ, but for


fuzzy case à ∪ B̃
= X and à ∩ B̃
= φ. Then, the same properties à ∪ B̃
= X and
à ∩ B̃
= φ have been verified as given in Figs. 2.8 and 2.9 respectively.

Fig. 2.8 Intersection of two


fuzzy sets

Fig. 2.9 Union of two fuzzy


sets
2.4 Intersection, Union, and Complement 37

Then, the computation of intersection and union of given fuzzy sets have been
incorporated in Example 2.4.

Example 2.4 Consider two fuzzy sets à and B̃ such that,


à = {(1, 0.1), (2, 0.5), (3, 0.8), (4, 1), (5, 0.7), (6, 0.3), (7, 0.1), (8, 0), (9, 0), (10, 0)},
B̃ = {(1, 0), (2, 0.2), (3, 0.8), (4, 1), (5, 1), (6, 0.3), (7, 0), (8, 0), (9, 0), (10, 0)}

having membership values μ Ã and μ B̃ , respectively. Evaluate the intersection and


union with respect to the fuzzy sets à and B̃.

Solution: The intersection and union are obtained as


C̃ = Ã ∩ B̃ = {(1, 0), (2, 0.2), (3, 0.8), (4, 1), (5, 0.7), (6, 0.3), (7, 0), (8, 0), (9, 0), (10, 0)

and
C̃ = Ã ∪ B̃ = {(1, 0.1), (2, 0.5), (3, 0.8), (4, 1), (5, 1), (6, 0.3), (7, 0.1), (8, 0), (9, 0), (10, 0).

Then, the corresponding C and MATLAB programming codes for estimation of


intersection, union, and complement of two fuzzy sets have been given in Programs
2.5 and 2.6, respectively.

Program 2.5: Write a C program for computing intersection, union, and comple-
ment of two given fuzzy sets.

//Intersection, union and complement of two fuzzy sets


#include<stdio.h>
#include<conio.h>
int main()
{
float max,min,x[10],a[10],b[10],c[10],mu1[10],mu2[10];
int i,j,n;
printf("Enter the number of elements in fuzzy sets A and B\n");
scanf("%d",&n);
printf("Enter the x values in A={(x, muA(x))}\n");
for(i=1;i<=n;i++)
{
scanf("%f",&a[i]);
}
printf("Enter the corresponding membership values in A\n");
for(i=1;i<=n;i++)
{
scanf("%f",&mu1[i]);
}
38 2 Fuzzy Sets

printf("Enter the x values in B={(x,muB(x))}\n");


for(i=1;i<=n;i++)
{
scanf("%f",&b[i]);
}
printf("Enter the membership values in B\n");
for(i=1;i<=n;i++)
{
scanf("%f",&mu2[i]);
}
printf("\n\nThe intersection of fuzzy sets A and B is:\n");
printf("{");
for(i=1;i<=10;i++)
{
for(j=1;j<=10;j++)
{
if(a[i]==b[j])
{
if(mu1[i]<mu2[j])
{
min=mu1[i];
}
else
{
min=mu2[j];
}
printf("(%f,%f) ",a[i],min);
c[i]=a[i];
}
}
}
printf("}\n");
printf("\nThe union of fuzzy sets A and B is:\n");
printf("{");
for(i=1;i<=10;i++)
{
for(j=1;j<=10;j++)
{
2.4 Intersection, Union, and Complement 39

if(a[i]==b[j])
{
if(mu1[i]>mu2[j])
{
max=mu1[i];
}
else
{
max=mu2[j];
}
printf("(%f,%f) ",a[i],max);
c[i]=a[i];
}
}
if(a[i]!=c[i]&&b[i]!=c[i])
{
printf("(%f,%f) ",a[i],mu1[i]);
printf("(%f,%f) ",b[i],mu2[i]);
}
}
printf("}\n");
printf("\nThe complement of fuzzy set A is:\n");
printf("{");
for(i=1;i<=10;i++)
{
printf("(%f,%f) ",a[i],1-mu1[i]);
}
printf("}\n");
printf("\nThe complement of fuzzy B is:\n");
printf("{");
for(i=1;i<=10;i++)
{
printf("(%f,%f) ",b[i],1-mu2[i]);
}
printf("}\n");
getch();
return 0;
}

Program 2.5 has been executed for Example 2.4 to compute the intersection and
union of the fuzzy sets.
40 2 Fuzzy Sets

Input:
Enter the number of elements in fuzzy sets A and B
10
Enter the x values in A={(x, muA(x))}
1 2 3 4 5 6 7 8 9 10
Enter the corresponding membership values in A
0.1 0.5 0.8 1 0.7 0.3 0.1 0 0 0
Enter the x values in B={(x,muB(x))}
1 2 3 4 5 6 7 8 9 10
Enter the membership values in B
0 0.2 0.8 1 1 0.3 0 0 0 0

Output:
The intersection of fuzzy sets A and B is:
{(1.000000,0.000000) (2.000000,0.200000) (3.000000,0.800000)
(4.000000,1.000000) (5.000000,0.700000) (6.000000,0.300000)
(7.000000,0.000000) (8.000000,0.000000) (9.000000,0.000000)
(10.000000,0.000000) }

The union of fuzzy sets A and B is:


{(1.000000,0.100000) (2.000000,0.500000) (3.000000,0.800000)
(4.000000,1.000000) (5.000000,1.000000) (6.000000,0.300000)
(7.000000,0.100000) (8.000000,0.000000) (9.000000,0.000000)
(10.000000,0.000000) }

The complement of fuzzy set A is:


{(1.000000,0.900000) (2.000000,0.500000) (3.000000,0.200000)
(4.000000,0.000000) (5.000000,0.300000) (6.000000,0.700000)
(7.000000,0.900000) (8.000000,1.000000) (9.000000,1.000000)
(10.000000,1.000000) }

The complement of fuzzy B is:


{(1.000000,1.000000) (2.000000,0.800000) (3.000000,0.200000)
(4.000000,0.000000) (5.000000,0.000000) (6.000000,0.700000)
(7.000000,1.000000) (8.000000,1.000000) (9.000000,1.000000)
(10.000000,1.000000) }

Then, the output window for Program 2.5 is depicted in Fig. 2.10.
2.4 Intersection, Union, and Complement 41

Fig. 2.10 Output of intersection, union, and complement of fuzzy sets A and B

Program 2.6: Write a MATLAB program for computing intersection, union, and
complement of two given fuzzy sets.

%Intersection, union and complement of two fuzzy sets


clear all;
clc;
a = input('Enter the elements x in fuzzy set A1=(x,muA1(x)):\n');
mu1 = input('Enter the corresponding membership values in A1:\n');
n = length(a);
b = input('Enter the elements x in fuzzy set A2=(x,muA2(x)):\n');
mu2 = input('Enter the corresponding membership values in A2:\n');
m = length(b);
%Union and intersection
k = 1;
for i=1:n
c(i) = a(i);
for j=1:m
if(a(i) == b(j))
muI(k) = min(mu1(i),mu2(j));
muU(k) = max(mu1(i),mu2(j));
k = k+1;
end
end
42 2 Fuzzy Sets

end
disp('The intersection of A1 and A2 is (x,muI(x)):');
disp(' x muI(x)');
disp([c' muI'])
disp('The union of A1 and A2 is (x,muU(x)):');
disp(' x muU(x)');
disp([c' muU'])
%Complement
disp('The complement of set A1 is:');
disp(' x muA1c(x)');
disp([a' (1-mu1)'])
disp('The complement of set A2 is:');
disp(' x muA2c(x)');
disp([a' (1-mu2)'])

Further, using Program 2.5, Example 2.4 is computed to obtain the intersection
and union of the fuzzy sets.

Input:
Enter the elements x in fuzzy set A1=(x,muA1(x)):
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Enter the corresponding membership values in A1:
[0.1, 0.5, 0.8, 1, 0.7, 0.3, 0.1, 0, 0, 0]
Enter the elements x in fuzzy set A2=(x,muA2(x)):
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Enter the corresponding membership values in A2:
[0, 0.2, 0.8, 1, 1, 0.3, 0, 0, 0, 0]

Output:
The intersection of A1 and A2 is (x,muI(x)):
x muI(x)
1.0000 0
2.0000 0.2000
3.0000 0.8000
4.0000 1.0000
5.0000 0.7000
6.0000 0.3000
7.0000 0
8.0000 0
9.0000 0
10.0000 0
2.4 Intersection, Union, and Complement 43

The union of A1 and A2 is (x,muU(x)):


x muU(x)
1.0000 0.1000
2.0000 0.5000
3.0000 0.8000
4.0000 1.0000
5.0000 1.0000
6.0000 0.3000
7.0000 0.1000
8.0000 0
9.0000 0
10.0000 0

The complement of set A1 is:

x muA1c(x)
1.0000 0.9000
2.0000 0.5000
3.0000 0.2000
4.0000 0
5.0000 0.3000
6.0000 0.7000
7.0000 0.9000
8.0000 1.0000
9.0000 1.0000
10.0000 1.0000

The complement of set A2 is:


x muA2c(x)
1.0000 1.0000
2.0000 0.8000
3.0000 0.2000
4.0000 0
5.0000 0
6.0000 0.7000
7.0000 1.0000
8.0000 1.0000
9.0000 1.0000
10.0000 1.0000

The next section discusses other operations, viz., power, algebraic sum, bounded
sum, bounded difference, and algebraic product for fuzzy sets.
44 2 Fuzzy Sets

2.5 Other Operations

Apart from the operations discussed in Sect. 2.4, there exist other operations as stated
below:
• mth power of a fuzzy set: The mth power of a fuzzy set à is defined as

Ãm = {(x, μ Ã (x))|x ∈ X }, (2.1)



m
where μ Ãm (x) = μ Ã (x) .
• Algebraic sum: Algebraic sum of two fuzzy sets à and B̃ is considered as

C̃ = Ã + B̃ = {(x, μ Ã+ B̃ (x))|x ∈ X }, (2.2)

where μ Ã+ B̃ (x) = μ Ã (x) + μ B̃ (x) − μ Ã (x) · μ B̃ (x).


• Bounded sum: Bounded sum of two fuzzy sets à and B̃ is defined as

C̃ = Ã ⊕ B̃ = {(x, μ Ã⊕ B̃ (x))|x ∈ X }, (2.3)



where μ Ã⊕ B̃ (x) = min 1, μ Ã (x) + μ B̃ (x) .
• Bounded difference: Bounded difference of two fuzzy sets à and B̃ is defined as

C̃ = Ã − B̃ = {(x, μ Ã− B̃ (x))|x ∈ X }, (2.4)



where μ Ã− B̃ (x) = max 0, μ Ã (x) + μ B̃ (x) − 1 .
• Algebraic product: Bounded difference of two fuzzy sets à and B̃ is defined as

C̃ = à • B̃ = {(x, μ Õ B̃ (x))|x ∈ X }, (2.5)

where μ Õ B̃ (x) = μ à (x) • μ B̃ (x).


In the present context, only bounded sum and difference have been discussed
using Example 2.5.

Example 2.5 Compute the bounded sum and difference of two fuzzy sets à =
{(3, 0.5), (5, 1), (7, 0.6)} and B̃ = {(3, 1), (5, 0.6)}.

Solution: According to Eqs. (2.3) and (2.4), the bounded sum and difference are
obtained, respectively, as

C̃ = Ã ⊕ B̃ = {(3, 1), (5, 1), (7, 0.6)} and C̃ = Ã − B̃ = {(3, 0.5), (5, 0.6)}.
2.5 Other Operations 45

Corresponding C and MATLAB programming codes to compute bounded sum and


difference for fuzzy sets have been incorporated in Programs 2.7 and 2.8, respectively.

Program 2.7: Find the bounded sum and bounded difference of given fuzzy sets
using C program.

//Bounded sum and bounded difference of two fuzzy sets


#include<stdio.h>
#include<conio.h>
float max(float y1,float y2)
{
float mx;
if(y1>y2)
mx=y1;
else
mx=y2;
return mx;
}
float min(float y1, float y2)
{
float mn;
if(y1<y2)
mn=y1;
else
mn=y2;
return mn;
}
int main()
{
int n,m,i,j,k;
float x1[10],x2[10],mu1[10],mu2[10],s[10],d[10],ms[10],md[10];
printf("Enter the number of elements in fuzzy set A and B:\n");
scanf("%d",&n);
printf("Enter the x values in A={(x,muA(x))}\n");
for(i=1;i<=n;i++)
scanf("%f",&x1[i]);
printf("Enter the corresponding membership values in A\n");
for(i=1;i<=n;i++)
scanf("%f",&mu1[i]);
printf("\nEnter the x values in B={(x,muB(x))}\n");
for(i=1;i<=n;i++)
scanf("%f",&x2[i]);
printf("Enter the corresponding membership values in B\n");
for(i=1;i<=n;i++)
scanf("%f",&mu2[i]);
46 2 Fuzzy Sets

printf("\nThe bounded sum of given fuzzy sets is:\n{");


for(i=1;i<=n;i++)
{
if(x1[i]==x2[i])
{
s[i]=x1[i];
ms[i]=min(1,(mu1[i]+mu2[i]));
}
printf("(%f,%f) ",s[i],ms[i]);
}
printf("}\nThe bounded difference of given fuzzy sets is:\n{ ");
for(i=1;i<=n;i++)
{
if(x1[i]==x2[i])
{
d[i]=x1[i];
md[i]=max(0,(mu1[i]+mu2[i])-1);
}
printf("(%f,%f) ",d[i],md[i]);
}
printf("}\n");
getch();
return 0;
}

Then, Program 2.7 has been executed with respect to Example 2.5.

Input:
Enter the number of elements in fuzzy set A and B:
3
Enter the x values in A={(x,muA(x))}
357
Enter the corresponding membership values in A
0.5 1 0.6
Enter the x values in B={(x,muB(x))}
357
Enter the corresponding membership values in B
1 0.6 0

Output:
The bounded sum of given fuzzy sets is:
{(3.000000,1.000000) (5.000000,1.000000) (7.000000,0.600000) }
The bounded difference of given fuzzy sets is:
{ (3.000000,0.500000) (5.000000,0.600000) (7.000000,0.000000) }
2.5 Other Operations 47

Fig. 2.11 Output of bounded sum and difference of two fuzzy sets

The output window for the above Program 2.7 is depicted in Fig. 2.11.
Program 2.8: Write a MATLAB program for finding the bounded sum and bounded
difference of given fuzzy sets.
%Bounded sum and bounded difference of two fuzzy sets
clear all;
clc;
a = input('Enter the elements x in fuzzy set A=(x,muA(x)):\n');
mu1 = input('Enter the corresponding membership values in A:\n');
n = length(a);
b = input('Enter the elements x in fuzzy set B=(x,muB(x)):\n');
mu2 = input('Enter the corresponding membership values in B:\n');
m = length(b);
k=1;
disp('The bounded sum of x having membership values (ms) for the given fuzzy sets
is:');
for i=1:n
if(a(i)==b(i))
ms(i)=min(1,mu1(i)+mu2(i));
end
end
disp(' x ms')
disp([a' ms'])
disp('The bounded difference of x having membership values (md) for the given
fuzzy sets is:');
for i=1:n
if(a(i)==b(i))
md(i)=max(0,(mu1(i)+mu2(i))-1);
end
end
disp(' x md')
disp([a' md'])
Using Program 2.8, the bounded sum and difference for the fuzzy sets given in
Example 2.5 are then obtained.
48 2 Fuzzy Sets

Input:
Enter the elements x in fuzzy set A=(x,muA(x)):
[3, 5, 7]
Enter the corresponding membership values in A:
[0.5, 1, 0.6]
Enter the elements x in fuzzy set B=(x,muB(x)):
[3, 5, 7]
Enter the corresponding membership values in B:
[1, 0.6, 0]

Output:
The bounded sum of x having membership values (ms) for the given fuzzy sets is:
x ms
3.0000 1.0000
5.0000 1.0000
7.0000 0.6000

The bounded difference of x having membership values (md) for the given fuzzy
sets is:
x md
3.0000 0.5000
5.0000 0.6000
7.0000 0

The extension principle incorporated in the next section helps in generalization


of crisp sets to fuzzy sets in terms of extended mapping for the fuzzy sets.

2.6 Extension Principle

Consider a mapping f : X → Y such that X = X 1 × X 2 × · · · × X r and y =


f (x1 , x2 , . . . , xr ), then the extension principle defines a fuzzy set B̃ in Y as B̃ =
{(y, μ B̃ (y)|y = f (x1 , x2 , . . . , xr ), x1 , x2 , . . . , xr ∈ X }, where

⎨ sup min{μ Ã1 (x1 ), μ Ã2 (x2 ), . . . , μ Ãr (xr )}, if f −1 (y)
= φ
μ B̃ (y) = x ,x
1 2 ,...,x r ∈ f −1 (y)
⎩ 0, other wise.
(2.6)

If r = 1, then B̃ = {(y, μ B̃ (y)|y = f (x), x ∈ X } and


2.6 Extension Principle 49

⎨ sup μ Ã (x), i f f −1 (y)
= φ
μ B̃ (y) = x∈ f −1 (y) (2.7)
⎩ 0, other wise

Using the extension principle, the computation of fuzzy image is performed in


Examples 2.6 and 2.7.

Example 2.6 Find B̃ if à = {(−1, 0.5), (0, 0.8), (1, 1), (2, 0.4)} and f (x) = x 2 .

Solution: According to Eq. (2.6) we obtain, B̃ =


{(0, μ B̃ (0)), (1, μ B̃ (1)), (4, μ B̃ (4)) where μ B̃ (0) = sup {0.8} = 0.8, μ B̃ (1) = 1
0∈ f −1 (0)
and μ B̃ (4) = 0.4.

Example 2.7 Find B̃ if Ã1 = {(−1, 1), (0, 0.4), (1, 0.2)} and Ã2 =
{(−1, 0.5), (0, 0.08), (1, 1)} be two fuzzy sets having mapping f (x1 , x2 ) = x12 + x22 .

Solution: Using Eq. (2.6) for r = 2, we obtain B̃ =


{(0, μ B̃ (0)), (1, μ B̃ (1)), (2, μ B̃ (2))} where

μ B̃ (0) = sup min{0.4, 0.08} = 0.08,


(0,0)∈ f −1 (y)

μ B̃ (1) = sup {min(1, 0.08), min(0.4, 0.5), min(0.2, 0.5), min(0.2, 1)} = 0.4
(−1,0),(0,−1),(0,1),
(1,0)∈ f −1 (y)

and

μ B̃ (2) = sup {min(1, 0.5), min(1, 1), min(0.2, 0.5), min(0.2, 1)} = 1.
(−1,−1),(−1,1),(1,−1),
(1,1)∈ f −1 (y)

So, B̃ = {(0, 0.2), (1, 0.4), (2, 1)}. Accordingly, the corresponding MATLAB
programs for Example 2.7 have been incorporated in Program 2.9.

Program 2.9: Write a MATLAB program depicting the usage of extension principle
for computation of fuzzy image.

%Extension principle of fuzzy sets


clear all;
clc;
a = input('Enter the elements x in fuzzy set A1=(x,muA1(x)):\n');
mu1 = input('Enter the corresponding membership values in A1:\n');
n = length(a);
b = input('Enter the elements x in fuzzy set A2=(x,muA2(x)):\n');
mu2 = input('Enter the corresponding membership values in A2:\n');
m = length(b);
50 2 Fuzzy Sets

%Finding B using extension principle


for i=1:n
for j=1:m
e(i,j) = func(a(i),b(j));
mu(i,j) = min(mu1(i),mu2(j));
end
end
disp('The membership values of fuzzy set B using extension principle is:');
ek = unique(e);
p = length(ek);
for k=1:p
mx = 0;
for i=1:n
for j=1:m
if(e(i,j)==ek(k))
mx = max(mu(i,j),mx);
end
end
end
mue(k)=mx;
end
disp(' y muB(y)');
disp([ek, mue']);

Using Program 2.9, the fuzzy set B̃ given in Example 2.6 is obtained using the
extension principle.

Input:
Enter the elements x in fuzzy set A1=(x,muA1(x)):
[-1, 0, 1]
Enter the corresponding membership values in A1:
[1, 0.4, 0.2]
Enter the elements x in fuzzy set A2=(x,muA2(x)):
[-1, 0, 1]
Enter the corresponding membership values in A2:
[0.5, 0.08, 1]

Output:
The membership values of fuzzy set B using extension principle is:
y muB(y)
0 0.0800
1.0000 0.4000
2.0000 1.0000

Books viz. Zimmerman (2001), Klir and Folger (2006), and Lee (2006) may be
referred by the readers for further knowledge. Finally, few unsolved problems have
been included below for self-evaluation.
2.6 Extension Principle 51

Exercise
1. Write a C program to compute the union and intersection for given number of
fuzzy sets.
2. Write C or MATLAB codes for computing the mth power of a fuzzy set for a
given fuzzy set Ã.
3. Find algebraic sum and product of any two fuzzy sets with the help of C or
MATLAB programming codes.
4. Write MATLAB codes to find a fuzzy set B̃ in Y using the extension principle
for a particular r.
5. Based on the extension principle, compute the fuzzy image of given fuzzy sets
using C programming.

References

G.J. Klir, T.A. Folger, Fuzzy Sets, Uncertainty and Information (Prentice Hall of India Private
Limited, New Delhi, 2006)
K.H. Lee, First Course on Fuzzy Theory and Applications (Springer, New York, 2006)
H.J. Zimmerman, Fuzzy Set Theory and Its Applications (Springer, New York, 2001)
Chapter 3
Fuzzy Numbers

In this chapter, preliminaries related to fuzzy numbers have been discussed. Fuzzy
numbers and fuzzy arithmetic may be considered as an extension of classical real
numbers and its arithmetic. As such, we may understand fuzzy arithmetic as basics
for handling fuzzy eigenvalue problems, nonlinear equations, system of nonlinear
equations (Abbasbandy and Asady 2004), differential equations (Chakraverty et al.
2016), etc. There exist different types of fuzzy numbers as discussed in Hanss (2005),
but for the sake of completeness of the chapter, triangular, trapezoidal, and Gaussian
fuzzy numbers based on the membership functions have only been included here.
Further, the conversions of these fuzzy numbers to fuzzy intervals with respect to the
concept of intervals (Chap. 1) are incorporated. In this regard, the interval arithmetic
mentioned in Chap. 1 has been further extended to fuzzy intervals in Sect. 3.4.

3.1 Preliminaries of Fuzzy Numbers

A convex fuzzy set à is a fuzzy set having membership function μ à (x), satisfying

μ Ã (λx1 + (1 − λ)x2 ) ≥ min(μ Ã (x1 ), μ Ã (x2 )), (3.1)

where x1 , x2 ∈ X and λ ∈ [0, 1]. Figure 3.1 depicts convex and non-convex fuzzy
sets.
Convex fuzzy sets defined with respect to universal set  (set of all real numbers)
may be interpreted as fuzzy numbers. In this respect, the classical definition of fuzzy
number is given below.
Fuzzy number: A fuzzy set à is referred as a fuzzy number ã if the following
properties are satisfied:
• Ã is convex,
• Ã is normalized, sup μ Ã (x) = 1,
x
• ∃ at least one x ∈  such that μ Ã (x) = 1, and
© Springer Nature Singapore Pte Ltd. 2019 53
S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_3
54 3 Fuzzy Numbers

Fig. 3.1 (a) Convex and (b) non-convex fuzzy sets

Fig. 3.2 (a) Non-normalized and (b) normalized fuzzy sets

• μ Ã (x) is piecewise continuous.


The fuzzy set à having membership function μ à (x) given in Fig. 3.2a is a non-
normalized convex fuzzy set as

sup μ Ã (x) = 0.6.


x

As such, the fuzzy set may not be considered as a fuzzy number. In such cases, the
fuzzy set may be normalized to form a fuzzy number b̃ having membership function
μ (x)
μb̃ (x) = sup à μ (x) (Fig. 3.2b).

x
Then, the fuzzy numbers may be classified into various categories depending on
the respective membership functions. In this regard, three types of fuzzy numbers
have been incorporated in next section.

3.2 Types of Fuzzy Numbers

In this section, we have discussed three types of fuzzy numbers, viz., Triangular Fuzzy
Number (TFN), Trapezoidal Fuzzy Number (TrFN), and Gaussian Fuzzy Number
(GFN). Further, C and MATLAB codes have been incorporated for computation of
different fuzzy numbers.
3.2 Types of Fuzzy Numbers 55

3.2.1 Triangular Fuzzy Number (TFN)

A TFN ã is considered as a special case triangular-shaped fuzzy number as shown


in Fig. 3.3, where the membership function of TFN ã = t f n(a, b, c) for a < b < c
is given by μã (x) such that x, a, b, c ∈ .


⎪ 0, x <a

⎨ x−a , x ∈ [a, b]
μã (x) = b−a (3.2)
⎪ c−x
⎪ , x ∈ [b, c]
⎪ c−b
⎩ 0, x >c

It may be seen from Fig. 3.3 that a and c form the lower and upper bounds of the
TFN having membership values μã (a) = μã (c) = 0. Further, the membership value
corresponding to the TFN at x = b is μã (b) = 1 which means that the TFN takes
the crisp (exact) value at x = b.
In order to have a better understanding, we have considered a TFN in Example
3.1.
Example 3.1 Compute the membership function associated with TFN ã =
t f n(−1, 1, 2).
Solution: Here, a = −1, b = 1 and c = 2 with respect to TFN ã = t f n(a, b, c).
Accordingly, the membership function associated with the fuzzy number has been
obtained using Eq. (3.2) as


⎪ 0, x < −1
⎨ x+1
,x ∈ [−1, 1]
μã (x) = 2 .

⎪ 2 − x, x ∈ [1, 2]

0, x >2

For computational applicability, we have incorporated the construction of TFNs


using C programming.
Program 3.1: Write a C program to generate user-defined TFN associated with
membership function defined in Eq. (3.2).

Fig. 3.3 Triangular fuzzy


number
56 3 Fuzzy Numbers

//Generating triangular fuzzy number


#include<stdio.h>
#include<conio.h>
float tfnm(float na, float nb, float nc, float x)
{
float membrsp;
if (x < na)
membrsp = 0;
else if (x >= na && x <= nb)
membrsp = ((x-na)/(nb-na));
else if (x >= nb && x <= nc)
membrsp = ((nc-x)/(nc-nb));
else if (x > nc)
membrsp = 0;
return membrsp;
}

int main()
{
float a,b,c,mem,i;
printf("Enter the value of a, b and c for TFN (a,b,c)\n");
scanf("%f %f %f",&a,&b,&c);
printf("\n The generated TFN in the form of fuzzy set (x,mu(x)) is\n");
for(i=a;i<=c;i=i+0.1)
{
mem=tfnm(a,b,c,i);
printf("(%f,%f)\n",i,mem);
}
getch();
return 0;
}

Using Program 3.1, the output with respect to TFN ã = t f n(−2, 1, 2) has been
obtained.

Input:
Enter the value of a, b and c for TFN (a,b,c)
-2 1 2
3.2 Types of Fuzzy Numbers 57

Output:
The generated TFN in the form of fuzzy set (x,mu(x)) is
(-2.000000,0.000000)
(-1.800000,0.066667)
(-1.600000,0.133333)
(-1.400000,0.200000)
(-1.200000,0.266667)
(-1.000000,0.333333)
(-0.800000,0.400000)
(-0.600000,0.466667)
(-0.400000,0.533333)
(-0.200000,0.600000)
(0.000000,0.666667)
(0.200000,0.733333)
(0.400000,0.800000)
(0.600000,0.866667)
(0.800000,0.933333)
(1.000000,1.000000)
(1.200000,0.800000)
(1.400000,0.600000)
(1.600000,0.400000)
(1.800000,0.200000)

Further, the associated output window with respect to TFN ã = t f n(−2, 1, 2) is


depicted in Fig. 3.4.
It may be further verified that the output given in Fig. 3.4 forms a TFN equivalent
to the TFN obtained in Fig. 3.9.

Fig. 3.4 Output of TFN ã = t f n(−2, 1, 2)


58 3 Fuzzy Numbers

3.2.2 Trapezoidal Fuzzy Number (TrFN)

A TrFN ã = tr f n(a, b, c, d) as given in Fig. 3.5 may be considered as a fuzzy number


having membership function μã (x) for a < b < c < d where x, a, b, c, d ∈ ,


⎪ 0, x <a


⎪ x−a
⎨ b−a , x ∈ [a, b]
μã (x) = 1, x ∈ [b, c] (3.3)


⎪ d−x
⎪ , x ∈ [c, d]

⎩ d−c
0, x >d

Let us now consider an example to illustrate TrFN having membership function


given in Eq. (3.3).

Example 3.2 Find the membership function associated with TrFN ã =


tr f n(−3, 1, 2, 4).

Solution: Comparing with ã = tr f n(a, b, c, d) we have a = −3, b = 1, c = 2,


and d = 4. The membership associated with the given TrFN may be obtained using
Eq. (3.3) as


⎪ 0, x < −3



⎨ 4 , x ∈ [−3, 1]
x+3

μã (x) = 1, x ∈ [1, 2] .





⎪ 2 , x ∈ [2, 4]
4−x

⎩ 0, x >4

Corresponding C program for generation of user-defined TrFN is incorporated in


Program 3.2.

Fig. 3.5 Trapezoidal fuzzy


number
3.2 Types of Fuzzy Numbers 59

Program 3.2: Write a C program to generate a TrFN associated with membership


function defined with respect to Eq. (3.3).

//Generating trapezoidal fuzzy number


#include<stdio.h>
#include<conio.h>
float trfnm(float na, float nb, float nc, float nd, float x)
{
float membrsp;
if (x < na)
membrsp = 0;

else if (x >= na && x <= nb)


membrsp = ((x-na)/(nb-na));

else if (x >= nb && x <= nc)


membrsp = 1;

else if (x >= nc && x <= nd)


membrsp = ((nd-x)/(nd-nc));

else if (x > nd)


membrsp = 0;

return membrsp;
}

int main()
{
float a,b,c,d,mem,i;
printf("Enter the value of a, b, c and d for TrFN (a,b,c,d)\n");
scanf("%f %f %f %f",&a,&b,&c,&d);
printf("\n The generated TFN in the form of fuzzy set (x,mu(x)) is\n");
for(i=a;i<=d;i=i+0.5)
{
mem=trfnm(a,b,c,d,i);
printf("(%f,%f)\n",i,mem);
}
getch();
return 0;
}

Accordingly, using Program 3.2, the output with respect to TrFN ã =


t f n(−1, 2, 4, 6) has been obtained.
60 3 Fuzzy Numbers

Input:
Enter the value of a, b, c and d for TrFN (a,b,c,d)
-1 2 4 6

Output:
The generated TFN in the form of fuzzy set (x,mu(x)) is
(-1.000000,0.000000)
(-0.500000,0.166667)
(0.000000,0.333333)
(0.500000,0.500000)
(1.000000,0.666667)
(1.500000,0.833333)
(2.000000,1.000000)
(2.500000,1.000000)
(3.000000,1.000000)
(3.500000,1.000000)
(4.000000,1.000000)
(4.500000,0.750000)
(5.000000,0.500000)
(5.500000,0.250000)
(6.000000,0.000000)

Corresponding output window with respect to TrFN ã = tr f n(−1, 2, 4, 6) has


been depicted in Fig. 3.6.
It may be verified that the output given in Fig. 3.6 forms a TrFN equivalent to
the TrFN obtained in Fig. 3.9. Finally, the third type of fuzzy number, viz., GFN has
been introduced in the next section.

Fig. 3.6 Output of TrFN ã = tr f n(−1, 2, 4, 6)


3.2 Types of Fuzzy Numbers 61

Fig. 3.7 Gaussian fuzzy number

3.2.3 Gaussian Fuzzy Number (GFN)

A GFN ã = g f n(a, σ1 , σ2 ) where a ∈  and σ1 , σ2 ∈ + as given in Fig. 3.7 is


considered as a bell-shaped fuzzy number having membership function μã (x) for
x ∈  where
⎧ 2
⎨ − (x−a)
,x <a
2
2σ1
e
μã (x) = (3.4)

2
− (x−a)
,x ≥a
2
2σ2
e

Example 3.3 Find the membership function associated with GFN ã = g f n(2, 1, 3).

Solution: Comparing with ã = g f n(a, σ1 , σ2 ) we have a = 2, σ1 = 1 and σ2 = 3.


The membership associated with the given GFN is obtained using Eq. (3.4) as
 (x−2)2
e− 2 ,x <2
μã (x) = 2 .
− (x−2)
e 18 ,x ≥2

Then, C program for generation of user-defined GFN is incorporated in Program


3.3.
62 3 Fuzzy Numbers

Program 3.3: Write a C program to generate a GFN associated with membership


function defined with respect to Eq. (3.4).

//Generating Gaussian fuzzy number


#include<stdio.h>
#include<conio.h>
#include<math.h>
float gfnm(float na, float sig1, float sig2, float x)
{
float membrsp;
if (x < na)
membrsp = exp(-(pow((x-na),2)/(2*pow(sig1,2))));

else if (x <= na)


membrsp = exp(-(pow((x-na),2)/(2*pow(sig2,2))));

return membrsp;
}

int main()
{
float a,sigma1,sigma2,mem,i;
printf("Enter the value of a, sigma1 and sigma2 for GFN
(a,sigma1,sigma2)\n");
scanf("%f %f %f",&a,&sigma1,&sigma2);
if(sigma1>0 && sigma2>0)
printf("The GFN is (%f,%f,%f)\n",a,sigma1,sigma2);

else
{
printf("Error!\n");
printf("Enter positive values of sigma1 and sigma2\n");
scanf("%f %f",&sigma1,&sigma2);
}

printf("\n The generated GFN in the form of fuzzy set (x,mu(x)) is\n");
for(i=(a-sigma1);i<=(a+sigma2);i=i+0.5)
{
mem=gfnm(a,sigma1,sigma2,i);
printf("(%f,%f)\n",i,mem);
}
getch();
return 0;
}
3.2 Types of Fuzzy Numbers 63

Fig. 3.8 Output of GFN ã = g f n(−2, 1, 3)

Using Program 3.3, the output associated with GFN ã = g f n(−2, 1, 3) has been
obtained.

Input:
Enter the value of a, sigma1 and sigma2 for GFN (a,sigma1,sigma2)
-2 -1 3
Error!
Enter positive values of sigma1 and sigma2
13

Output:
The generated GFN in the form of fuzzy set (x,mu(x)) is
(-3.000000,0.606531)
(-2.500000,0.882497)
(-2.000000,1.000000)
(-1.500000,1.000000)
(-1.000000,1.000000)
(-0.500000,1.000000)
(0.000000,1.000000)
(0.500000,1.000000)
(1.000000,1.000000)

Further, the window corresponding to the above output is given in Fig. 3.8.
Here, the output obtained using Program 3.3 as given in Fig. 3.8 may be verified
as the GFN depicted in Fig. 3.9.
Let us now incorporate a MATLAB program for construction of the fuzzy num-
bers, viz., TFN, TrFN, and GFN in Program 3.4.
64 3 Fuzzy Numbers

Fig. 3.9 Output of fuzzy numbers ã = t f n(−2, 1, 2), ã = tr f n(−1, 2, 4, 6), and ã =
g f n(−2, 1, 3)

Program 3.4: Write a MATLAB program to generate user-defined TFN, TrFN, and
GFN

%Generate fuzzy numbers viz. TFN,TrFN and GFN


clc; clear all;
% Enter values of the fuzzy numbers TFN,TrFN and GFN
tfn = input('Enter the value of a,b and c for TFN (a,b,c)\n');
trfn = input('Enter the value of a, b, c and d for TrFN (a,b,c,d)\n');
gfn = input('Enter the value of a, sigma1 and sigma2 for GFN (a,sigma1,sigma2)\n');
x =[-10:0.1:10]'; %x values
yt = trimf(x,[tfn(1) tfn(2) tfn(3)]); %generates TFN membership function
ytr = trapmf(x,[trfn(1) trfn(2) trfn(3) trfn(4)]); %generates TFN membership
function
yg = gauss2mf(x,[gfn(2) gfn(1) gfn(3) gfn(1)]); %generates TFN membership
function
plot(x,yt,'-r','LineWidth',2)
hold on
plot(x,ytr,'-b','LineWidth',2)
plot(x,yg,'-k','LineWidth',2)
xlabel('x')
ylabel('\mu(x)')
ylim([-0.05 1.05])
legend('tfn(a,b,c)','trfn(a,b,c,d)','gfn(a,\sigma_1,\sigma_2)')

Using the MATLAB codes given in Program 3.4, one may generate TFN ã =
t f n(−2, 1, 2), TrFN ã = tr f n(−1, 2, 4, 6) and GFN ã = g f n(−2, 1, 3). Further,
the MATLAB plot obtained using Program 3.4 has been depicted in Fig. 3.9.
3.2 Types of Fuzzy Numbers 65

Input:
Enter the value of a,b and c for TFN (a,b,c)
[-2 1 2]
Enter the value of a, b, c and d for TrFN (a,b,c,d)
[-1 2 4 6]
Enter the value of a, sigma1 and sigma2 for GFN (a,sigma1,sigma2)
[-2 1 3]

In next section, the conversion of fuzzy numbers to respective fuzzy intervals


using α-cut form has been discussed. As such, the α-cut definition is recapitulated
below.
α-cut: The α-cut associated with a fuzzy number ã is the crisp set

aα = {x ∈ |μã (x) ≥ α} (3.5)

3.3 Conversion of Fuzzy Number to Interval Form Using


α-Cut

Using α-cut form given in Eq. (3.5), the fuzzy numbers may be written in terms of
fuzzy intervals as aα = [a(α), ā(α)]. In this regard, fuzzy intervals corresponding to
the fuzzy numbers discussed in Sects. 3.3.1 to 3.3.3 have been obtained in successive
sections.

3.3.1 Triangular Fuzzy Number α-Cut Decomposition

A TFN Ã = (a, b, c) may be converted to its fuzzy interval form using α-cut for
α ∈ [0, 1] by substituting

x −a c−x
= α and = α. (3.6)
b−a c−b
⇒ x = α(b − a) + a and x = c − α(c − b). (3.7)

Accordingly, the fuzzy interval using α-cut is obtained as

ã = aα = [a(α), ā(α)] = [a + α(b − a), c − α(c − b)], (3.8)

where α ∈ [0, 1].


It is worth mentioning that for α = 0, the TFN in Eq. (3.8) takes the interval form
[a, c], whereas for α = 1, the TFN results to a crisp number c. Similarly, the α-cut
66 3 Fuzzy Numbers

decompositions for TrFN and GFN have been incorporated in Sects. 3.3.2 and 3.3.3,
respectively.

3.3.2 Trapezoidal Fuzzy Number α-Cut Decomposition

A TrFN ã = (a, b, c, d) is converted to its fuzzy interval form using α-cut as

ã = aα = [a(α), a(α)] = [a + α(b − a), d − α(d − c)] (3.9)

x−a
by substituting b−a = α and d−x
d−c
= α in Eq. (3.3), where α ∈ [0, 1]. Again, it may
be observed from Eq. (3.9) that TrFN takes the interval form [a, d] and crisp interval
[b, c] for α = 0 and α = 1, respectively.

3.3.3 Gaussian Fuzzy Number α-Cut Decomposition

In case of GFN ã = (a, σ1 , σ2 ), the fuzzy interval form using α-cut is obtained as
 
ã = aα = [a(α), a(α)] = [a − σ1 −2 log r , a + σ1 −2 log r ], (3.10)
 
2 2
− (x−a) − (x−a)
∀α ∈ [0, 1] by substituting e = α and e = α in Eq. (3.4).
2σ1 2 2
2σ2

Equations (3.8)–(3.10) take the interval form with respect to α parameter. As such,
the classical interval arithmetic discussed in Sects. 1.1.1–1.1.3 (Chap. 1) has been
extended for fuzzy intervals in the next section.

3.4 Fuzzy Arithmetic

Fuzzy arithmetic comprises arithmetic operations for fuzzy sets defined over univer-
sal set . A detailed introduction of fuzzy arithmetic and its applications in various
engineering problems have been discussed in Hanss (2005). Fuzzy arithmetic and its
application may also be found in books (Klir and Yuan 1995; Lee 2006).

3.4.1 Arithmetic Operations of Fuzzy Numbers

The fuzzy interval arithmetic similar to operations of intervals for two fuzzy numbers
ã = [a(α)] and b̃ = [b(α)] for α ∈ [0, 1] may be written as
3.4 Fuzzy Arithmetic 67

• Addition: ã + b̃ = [a(α) + b(α), a(α) + b(α)],


• Subtraction: ã − b̃ = [a(α) − b(α), a(α) − b(α)],
• Multiplication: ã · b̃ = [min{a(α) · a(α), a(α) · b(α), a(α) · b(α), a(α) · b(α)},

max{a(α) · a(α), a(α) · b(α), a(α) · b(α), a(α) · b(α))}], and




a(α) ā(α)
, ,0∈
/ [b(α)]
• Division: ã

= b̄(α) b(α)
(−∞, ∞), 0 ∈ [b(α)]

Example 3.4 Compute the addition, subtraction, multiplication, and division of two
fuzzy numbers ã = t f n(1, 2, 3) and b̃ = tr f n(4, 5, 6, 7).

Solution: Using Eqs. (3.8) and (3.9), the fuzzy intervals with respect to α-cut decom-
position are obtained as

[a(α), ā(α)] = [1 + α, 3 − α] and [b(α), b̄(α)] = [4 + α, 7 − α],

respectively. Accordingly, the arithmetic operations, viz., addition, subtraction, mul-


tiplication, and division for α ∈ [0, 1] may be computed as
Addition: ã + b̃ = [5 + 2α, 10 − 2α],
Subtraction: ã − b̃ = [−6 + 2α, 1 − 2α],
Multiplication: ã · b̃ = [4 + 5α + α2 , 21 − 10α + α2 ], and
Division: ãb̃ = 1+α , 3−α .
7−α 4+α
In this regard, a MATLAB program has been included in Program 3.5 for performing
the fuzzy arithmetic operations.
Program 3.5: Write MATLAB codes to perform addition, subtraction, multiplica-
tion, and division for two user-defined fuzzy numbers .

%Arithmetic operation on fuzzy numbers


% Enter values of two fuzzy numbers
tfn = input('Enter the value of a,b and c for TFN (a,b,c)\n');
trfn = input('Enter the value of a, b, c and d for TrFN (a,b,c,d)\n');
yt = trimf(x,[tfn(1) tfn(2) tfn(3)]); %generates TFN membership function
ytr = trapmf(x,[trfn(1) trfn(2) trfn(3) trfn(4)]); %generates TrFN membership
function
68 3 Fuzzy Numbers

%alpha-cut decomposition
i=1;
for alpha=0:0.1:1
%TFN decomposition
ytfi= [tfn(1)+alpha*(tfn(2)-tfn(1)), tfn(3)-alpha*(tfn(3)-tfn(2))];
%TrFN decomposition
ytrfi= [trfn(1)+alpha*(trfn(2)-trfn(1)), trfn(4)-alpha*(trfn(4)-trfn(3))];
%Addition
add(i,:)=[ytfi(1)+ytrfi(1), ytfi(2)+ytrfi(2)];
%Subtraction
sub(i,:)=[ytfi(1)-ytrfi(2), ytfi(2)-ytrfi(1)];
%Multiplication
S=[ytfi(1)*ytrfi(1), ytfi(2)*ytrfi(2),ytfi(1)*ytrfi(2), ytfi(2)*ytrfi(1)];
mul(i,:)=[min(S),max(S)];
%Division
if((trfn(1)+alpha*(trfn(3)-trfn(2))<0) && trfn(4)-alpha*(trfn(4)-
trfn(3))>=0)
disp('(-inf,inf)');
else
div(i,:)=[ytfi(1)/ytrfi(2),ytfi(2)/ytrfi(1)];
end
mu(i)=alpha;
i=i+1;
end
plot(add,mu,'-r*','Linewidth',2);
hold on
plot(sub,mu,'-ko','Linewidth',2);
plot(mul,mu,'-bs','Linewidth',2);
plot(div,mu,'-gd','Linewidth',2);
xlabel('x');
ylabel('\mu(x)');
set(gca, 'Fontsize', 10);

Using Program 3.5, one may obtain the arithmetic operations on two fuzzy num-
bers ã = t f n(2, 3, 4) and ã = tr f n(1, 2, 3, 4).

Input:
Enter the value of a,b and c for TFN (a,b,c)
[2,3,4]
Enter the value of a, b, c and d for TrFN (a,b,c,d)
[1,2,3,4]

The equivalent MATLAB plot corresponding to the input has been depicted in
Fig. 3.10.
3.4 Fuzzy Arithmetic 69

Fig. 3.10 Output of arithmetic operations on fuzzy numbers ã = t f n(2, 3, 4) and ã =


tr f n(1, 2, 3, 4)

Lastly, for self-evaluation of the readers, few unsolved problems have been
included.
Exercise:
1. Write a C program to compute arithmetic operations on fuzzy numbers ã =
t f n(2, 3, 4) and ã = tr f n(1, 2, 3, 4).
2. Compute the value of t f n(1, 2, 3) + tr f n(3, 6, 8)) × g f n(−4, 2, 1) using
C/MATLAB programs.

References

S. Abbasbandy, B. Asady, Newton’s method for solving fuzzy nonlinear equations. Appl. Math.
Comput. 159(2), 349–356 (2004)
S. Chakraverty, S. Perera (eds.), Recent Advances in Applications of Computational and Fuzzy
Mathematics (Springer, 2018)
S. Chakraverty, S. Tapaswini, D. Behera, Fuzzy Differential Equations and Applications for Engi-
neers and Scientists, (CRC Press, 2016)
M. Hanss, Applied Fuzzy Arithmetic (Springer-Verlag, Berlin Heidelberg, 2005)
G. Klir, B. Yuan, Fuzzy Sets and Fuzzy Logic, vol. 4, (Prentice Hall, London, New Jersey, 1995)
K.H. Lee, First Course on Fuzzy Theory and Applications (Springer Science and Business Media,
New York, 2006)
Chapter 4
Fuzzy Relations

In Chap. 2, definitions and preliminaries related to crisp sets have been extended in
terms of membership function for fuzzy sets. As such, the concept of crisp relations
may also be extended to fuzzy relations. In this chapter, basically we will discuss
the preliminaries related to fuzzy relations, operations, and compositions on fuzzy
relations.

4.1 Preliminaries of Fuzzy Relations

Crisp (classical) relation represents the connection between elements of two or more
sets. The crisp relation states whether the elements of different sets are related or
not with respect to each other. But, sometimes the strength of the relation between
the elements may be necessary for illustrating the dependency of the elements with
other elements. Definition of relation may be generalized to fuzzy relation where the
strength of dependency is expressed in terms of membership function.
Generally, a crisp relation R between two sets A and B is a subset of Cartesian
product. The strength between the elements in case of crisp relation may be defined
as

1, (x, y) ∈ X × Y
χ R (x, y) = .
0, (x, y) ∈
/ X ×Y

As such, a fuzzy relation R̃for two fuzzy sets à and B̃ is considered as an ordered
pair R̃ = (x, y), μ R (x, y) (x, y) ∈ X × Y , which may be referred as a subset
of Cartesian product of the two universal sets X̃ × Ỹ along with a degree of strength
or dependence of elements. In fuzzy relation, the strength of the relation is expressed
using relational membership function μ R̃ . A relational membership function is a map-
ping from μ R̃ : X × Y → [0, 1]. Similarly, the operations discussed in Chap. 2, viz.,
intersection, union, and complement of fuzzy set may be extended for fuzzy relations.

© Springer Nature Singapore Pte Ltd. 2019 71


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_4
72 4 Fuzzy Relations

Intersection of fuzzy relations: The intersection of fuzzy relations R̃ and S̃ is


defined as
   
R̃ ∩ S̃ = (x, y), μ R̃∩ S̃ (x, y) μ R̃∩ S̃ = min μ R̃ (x, y), μ S̃ (x, y) . (4.1)

Union of fuzzy  relations: The union of  two fuzzy rela-


tions
 R̃ = (x, y), μR̃ (x, y) (x, y) ∈ X × Y and S̃ =
(x, y), μ S̃ (x, y) (x, y) ∈ X × Y is defined as an ordered pair:
   
R̃ ∪ S̃ = (x, y), μ R̃∪ S̃ (x, y)  μ R̃∪ S̃ = max μ R̃ (x, y), μ S̃ (x, y) . (4.2)

Complement of fuzzy relation: The complement of a fuzzy relation is defined


as
  
R̃ c = (x, y), μ R̃ c (x, y) μ R̃ c = 1 − μ R̃ (x, y) . (4.3)

Containment of fuzzy relation: A relation R̃ is said to be contained in S̃ if

μ R̃ (x, y) < μ S̃ (x, y). (4.4)

4.2 Intersection, Union, and Complement

In this section, a numerical example for computing intersection, union, and comple-
ment of fuzzy relations has been illustrated based on Eqs. (4.1)–(4.3). Further, C and
MATLAB programs have been included to validate the results through the program.

Example 4.1 Consider two fuzzy relations R̃ and S̃ as given in Tables 4.1 and 4.2.
Compute the intersection and union of the two fuzzy relations.
Solution: Using Eqs. (4.1) and (4.2), the intersection and union of the two fuzzy
relations are obtained as

Table 4.1 Fuzzy relation R̃ μ R̃ = Ã B̃


for two fuzzy sets à and B̃ y1 y2 y3 y4
x1 0.8 1 0.1 0.7
x2 0 0.8 0 0
x3 0.9 1 0.7 0.8

Table 4.2 Fuzzy relation S̃ μ S̃ = Ã B̃


for two fuzzy sets à and B̃ y1 y2 y3 y4
x1 0.4 0 0.9 0.6
x2 0.9 0.4 0.5 0.7
x3 0.3 0 0.8 0.5
4.2 Intersection, Union, and Complement 73

Table 4.3 Intersection of μ R̃∩ S̃ = Ã B̃


fuzzy relations R̃ and S̃
y1 y2 y3 y4
x1 0.4 0 0.1 0.6
x2 0 0.4 0 0
x3 0.3 0 0.7 0.5

Table 4.4 Union of fuzzy μ R̃∪ S̃ = Ã B̃


relations R̃ and S̃
y1 y2 y3 y4
x1 0.8 1 0.9 0.7
x2 0.9 0.8 0.5 0.7
x3 0.9 1 0.8 0.8

Table 4.5 Complement of μ R̃ c = Ã B̃


fuzzy relation R̃
y1 y2 y3 y4
x1 0.2 0 0.9 0.3
x2 1 0.2 1 1
x3 0.1 0 0.3 0.2

   
R̃ ∩ S̃ = (x, y), μ R̃∩ S̃ (x, y) and R̃ ∪ S̃ = (x, y), μ R̃∪ S̃ (x, y)

as given in Tables 4.3 and 4.4, respectively.


  Then, the complement of relation R̃ is obtained using Eq. (4.3) as R̃ c =
(x, y), μ R̄ c (x, y) and incorporated in Table 4.5.
Using Eqs. (4.1)–(4.3), Program 4.1 is written through C programming for inter-
section, union, and complement of two fuzzy relations.

Program 4.1: Write a C program for computing intersection, union, and comple-
ment of two given fuzzy relations.

//Intersection, union and complement of fuzzy relations


#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int i,j,m,n;
float R[5][5], S[5][5], Tu[5][5], Ti[5][5], Rc[5][5], A[10], B[10], muA[10],
muB[10];
printf("Enter the number of elements in fuzzy set A:\n");
scanf("%d",&m);
printf("Enter the number of elements in fuzzy set B:\n");
scanf("%d",&n);
74 4 Fuzzy Relations

printf("Enter the fuzzy relational (%dx%d) matrix R:\n",m,n);


for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{
scanf("%f",&R[i][j]);
}
printf("Enter the fuzzy relational (%dx%d) matrix S:\n",m,n);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{
scanf("%f",&S[i][j]);
}
//Intersection
printf("\nThe intersection of fuzzy relational matrices R and S is:\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
if(R[i][j]<=S[i][j])
Ti[i][j]=R[i][j];
else
Ti[i][j]=S[i][j];
}
}
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
printf("%10f",Ti[i][j]);
}
printf("\n");
}
//Union
printf("\nThe union of fuzzy relational matrices R and S is:\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
if(R[i][j]>=S[i][j])
Tu[i][j]=R[i][j];
else
Tu[i][j]=S[i][j];
}
}
for(i=1;i<=m;i++)
4.2 Intersection, Union, and Complement 75

{
for(j=1;j<=n;j++)
{
printf("%10f",Tu[i][j]);
}
printf("\n");
}
//Complement
printf("\nThe complement of fuzzy relational matrix R is:\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
Rc[i][j]=1-R[i][j];
}
}
for(i=1;i<=m;i++)
{

for(j=1;j<=n;j++)
{
printf("%10f",Rc[i][j]);
}
printf("\n");
}
getch();
return 0;
}

Then, Program 4.1 has been used to compute the intersection, union, and com-
plement of two fuzzy relations given in Example 4.1.

Input:
Enter the number of elements in fuzzy set A:
3
Enter the number of elements in fuzzy set B:
4
Enter the fuzzy relational (3x4) matrix R:
0.8 1 0.1 0.7
0 0.8 0 0
0.9 1 0.7 0.8
Enter the fuzzy relational (3x4) matrix S:
0.4 0 0.9 0.6
0.9 0.4 0.5 0.7
0.3 0 0.8 0.5
76 4 Fuzzy Relations

Output:
The intersection of fuzzy relational matrices R and S is:
0.400000 0.000000 0.100000 0.600000
0.000000 0.400000 0.000000 0.000000
0.300000 0.000000 0.700000 0.500000

The union of fuzzy relational matrices R and S is:


0.800000 1.000000 0.900000 0.700000
0.900000 0.800000 0.500000 0.700000
0.900000 1.000000 0.800000 0.800000

The complement of fuzzy relational matrix R is:


0.200000 0.000000 0.900000 0.300000
1.000000 0.200000 1.000000 1.000000
0.100000 0.000000 0.300000 0.200000

The output window for Program 4.1 is given in Fig. 4.1.


Further, the same operations, viz., intersection, union, and complement for the
fuzzy relations have been computed using MATLAB in Program 4.2.

Fig. 4.1 Output of intersection, union, and complement of fuzzy relations


4.2 Intersection, Union, and Complement 77

Program 4.2: Compute intersection, union, and complement of two given fuzzy
relations using MATLAB.

%Intersection, union and complement of fuzzy relations


% Enter the matrices R and S in matrix form
R = input('Enter the fuzzy relational matrix R associated with fuzzy sets A and
B:\n');
S = input('Enter the fuzzy relational matrix S associated with fuzzy sets A and
B:\n');
%Intersection
disp('The intersection of fuzzy relational matrices R and S is:');
Intersection=min(R,S);
disp(Intersection);
%Union
disp('The union of fuzzy relational matrices R and S is:');
Union=max(R,S);
disp(Union);
%Complement
disp('The complement of fuzzy relational matrix R is:');
Complement=1-R;
disp(Complement);

The intersection, union, and complement of two fuzzy relations given in Example
4.1 have been obtained using the MATLAB codes mentioned in Program 4.2.

Input:
Enter the fuzzy relation matrix R associated with fuzzy sets A and B:
[0.8 1 0.1 0.7;0 0.8 0 0;0.9 1 0.7 0.8]
Enter the fuzzy relation matrix S associated with fuzzy sets A and B:
[0.4 0 0.9 0.6;0.9 0.4 0.5 0.7;0.3 0 0.8 0.5]

Output:
The intersection of fuzzy relation matrices R and S is:
0.4000 0 0.1000 0.6000
0 0.4000 0 0
0.3000 0 0.7000 0.5000
The union of fuzzy relation matrices R and S is:
0.8000 1.0000 0.9000 0.7000
0.9000 0.8000 0.5000 0.7000
0.9000 1.0000 0.8000 0.8000

The complement of fuzzy relational matrix R is:


0.2000 0 0.9000 0.3000
1.0000 0.2000 1.0000 1.0000
0.1000 0 0.3000 0.2000
78 4 Fuzzy Relations

The next section discusses the projection of fuzzy relation R̃ in terms of first,
second, and total projections.

4.3 First, Second, and Total Projection

For a fuzzy relation R̃ ⊂ X̃ × Ỹ of two sets, the projection has been classified in
terms of first, second, and total projections as
First projection:
 
   
PR̃ (1) (x, y) = (x, y), μ R̃ (1) (x, y) μ R̃ (1) (x, y) = max μ R̃ (x, y) . (4.5)
y

Second projection:
   

PR̃ (2) (x, y) = (x, y), μ R̃ (2) (x, y) μ R̃ (2) (x, y) = max μ R̃ (x, y) . (4.6)
x

Total projection:
 
   

PR̃ (T ) (x, y) = (x, y), μ R̃ (T ) (x, y) μ R̃ (T ) (x, y) = max max μ R̃ (x, y) .
x y
(4.7)

Now, consider an example for computing the first, second, and total projections
of a given fuzzy relation based on Eqs. (4.5)–(4.7).
  
Example 4.2 Consider a relation R̃ = (x, y), μ R̄ (x, y) (x, y) ∈ X × Y of two
fuzzy sets à and B̃ having relational membership function as given in Table 4.6.
Solution: The membership functions for first μ R̃ (1) (x, y), second μ R̃ (2) (x, y) and
total μ R̃ (T ) (x, y) projections have been obtained and incorporated in Table 4.7.
Example 4.2 is implemented using C and MATLAB codes in Programs 4.3 and
4.4, respectively.

Table 4.6 Fuzzy relation R̃ μ R̃ = Ã B̃


y1 y2 y3 y4 y5 y6
x1 0.1 0.2 0.4 0.8 1 0.8
x2 0.2 0.4 0.8 0.9 0.8 0.6
x3 0.4 0.8 0.4 0.8 0.4 0.2
4.3 First, Second, and Total Projection 79

Table 4.7 Projections of fuzzy relation R̃


à B̃
y1 y2 y3 y4 y5 y6 μ R̃ (1) (x, y)
x1 0.1 0.2 0.4 0.8 1 0.8 1
x2 0.2 0.4 0.8 0.9 0.8 0.6 0.9
x3 0.4 0.8 0.4 0.8 0.4 0.2 0.8
μ R̃ (2) (x, y) 0.4 0.8 0.8 0.9 1 0.8 μ R̃ (T ) (x, y) = 1

Program 4.3: Compute the first, second, and total projections for a given relation
of two fuzzy sets using C program.

//First, second and total projection


#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,m,n;
float u[10][10],mx1,mx2,mx3,mx4;
printf("Enter the number of elements in fuzzy set A:\n");
scanf("%d",&m);
printf("Enter the number of elements in fuzzy set B:\n");
scanf("%d",&n);
printf("Enter the entries in fuzzy relational (%dx%d) matrix R:\n",m,n);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&u[i][j]);
}
}
for(i=1;i<=m;i++)
{
mx1=u[i][1];
for(j=2;j<=n;j++)
{
if(u[i][j]>mx1)
mx1=u[i][j];
}
u[i][n+1]=mx1;
}
mx3=u[1][n+1];
for(i=2;i<=m;i++)
{
if(u[i][n+1]>mx3)
80 4 Fuzzy Relations

mx3=u[i][n+1];
}
for(j=1;j<=n;j++)
{
mx2=u[1][j];
for(i=2;i<=m;i++)
{
if(u[i][j]>mx2)
mx2=u[i][j];
}
u[m+1][j]=mx2;
}
mx4=u[m+1][1];
for(j=2;j<=n;j++)
{
if(u[m+1][j]>mx4)
mx4=u[m+1][j];
}
if(mx3>mx4)
u[m+1][n+1]=mx3;
else
u[m+1][n+1]=mx4;
printf("\nThe first (mu(1)), second (mu(2)) and total (mu(T)) projections of
fuzzy relational matrix R are:\n");
for(j=1;j<=(n+1);j++)
{
if(j==(n+1))
printf("mu(1)");
else
printf("y%d",j);
}
for(i=1;i<=m+1;i++)
{
if(i==(m+1))
printf("\nmu(2)");
else
printf("\nx%d",i);
for(j=1;j<=(n+1);j++)
printf("\t%f",u[i][j]);
}
printf("\n");
getch();
return 0;
}

Using Program 4.3, the projection of fuzzy relation given in Example 4.2 is
obtained.
4.3 First, Second, and Total Projection 81

Fig. 4.2 Output of projection of fuzzy relation R̃

Input:
Enter the number of elements in fuzzy set A:
3
Enter the number of elements in fuzzy set B:
6
Enter the entries in fuzzy relational (3x6) matrix R:
0.1 0.2 0.4 0.8 1 0.8
0.2 0.4 0.8 0.9 0.8 0.6
0.4 0.8 0.4 0.8 0.4 0.2

Output:
The first (mu(1)), second (mu(2)) and total (mu(T)) projections of fuzzy relational
matrix R are:
y1 y2 y3 y4 y5 y6 mu(1)
x1 0.100000 0.200000 0.400000 0.800000 1.000000 0.800000 1.000000
x2 0.200000 0.400000 0.800000 0.900000 0.800000 0.600000 0.900000
x3 0.400000 0.800000 0.400000 0.800000 0.400000 0.200000 0.800000
mu(2) 0.400000 0.800000 0.800000 0.900000 1.000000 0.800000 1.000000

Then, the output window obtained after executing Program 4.3 is depicted in
Fig. 4.2.

Program 4.4: Write a MATLAB program for computing first, second, and total
projections of two fuzzy sets.

%First, second and total projection


% Enter the relation matrix R in matrix form
R = input('Enter the entries in fuzzy relational matrix R:\n');
sr = size(R);
m = sr(1);
n = sr(2);
P = R;
for i=1:m
P(i,n+1)=max(R(i,:));
end
disp('The first projection P1 of fuzzy relation is:');
P1 = P(:,n+1);
82 4 Fuzzy Relations

disp(P1);
temp1 = max(P(:,n+1));
for j=1:n
P(m+1,j) = max(R(:,j));
end
disp('The second projection P2 of fuzzy relation is:');
P2 = P(m+1,:);
disp(P2);
temp2 = max(P(m+1,:));
disp('The total projection PT of fuzzy relation is:');
PT = max(temp1,temp2);
disp(PT);
P(m+1,n+1) = PT;
disp('The projection matrix P of fuzzy relation R is:');
disp(P);
The first, second, and total projections of the fuzzy sets given in Example 4.2 are
computed using MATLAB codes of Program 4.4.

Input:
Enter the entries in fuzzy relational matrix R:
[0.1 0.2 0.4 0.8 1 0.8;0.2 0.4 0.8 0.9 0.8 0.6;0.4 0.8 0.4 0.8 0.4 0.2]

Output:
The first projection P1 of fuzzy relation is:
1.0000
0.9000
0.8000

The second projection P2 of fuzzy relation is:


0.4000 0.8000 0.8000 0.9000 1.0000 0.8000 0

The total projection PT of fuzzy relation is:


1

The projection matrix P of fuzzy relation R is:


0.1000 0.2000 0.4000 0.8000 1.0000 0.8000 1.0000
0.2000 0.4000 0.8000 0.9000 0.8000 0.6000 0.9000
0.4000 0.8000 0.4000 0.8000 0.4000 0.2000 0.8000
0.4000 0.8000 0.8000 0.9000 1.0000 0.8000 1.0000

It is worth mentioning that the relation R̃ ⊂ X̃ × Ỹ is a fuzzy relation for two


fuzzy sets. Similarly, the projections discussed above may be further extended to
fuzzy relations for multiple (more than two) fuzzy sets. It is left to the reader to
implement a generalized program for computation of projections for multiple fuzzy
sets.
4.4 Composition of Fuzzy Relations 83

The next section presents the fuzzy composition techniques for fuzzy relations.

4.4 Composition of Fuzzy Relations

Composition of two crisp relations R ◦ S where R ⊂ A × B and S ⊂ B × C for


A, B, C ⊂ X signifies the dependence of elements of sets A and C. But, the crisp
composition fails to explain the strength of dependency. As such, the idea of crisp
composition may be extended to composition of fuzzy relations.
There exist basically three compositions for fuzzy relations:
• Max-min composition,
• Max-product composition, and
• Max-average composition.
Max-min composition: The max-min composition for the fuzzy relations R̃ and
S̃ is defined as
 
R̃max-min S̃ = (x, z), μ R̃max-min S̃ (x, z) μ R̃max-min S̃ (x, z)

 
= max min μ R̃ (x, y), μ S̃ (y, z) . (4.8)
y

Max-product composition: The max-product composition is defined as




R̃max-product S̃ = (x, z), μ R̃max-product S̃ (x, z) μ R̃max-product S̃ (x, z)

 
= max μ R̃ (x, y), μ S̃ (y, z) . (4.9)
y

Max-average composition: Max-average composition for the fuzzy relations R̃


and S̃ is defined as


R̃max-avg S̃ = (x, z), μ R̃max-avg S̃ (x, z) μ R̃max-avg S̃ (x, z)

1  
= max μ R̃ (x, y) + μ S̃ (y, z) . (4.10)
2 y

Based on Eq. (4.8), an example for computing max-min composition of given


fuzzy relations has been discussed in Example 4.3.
84 4 Fuzzy Relations

Fig. 4.3 Composition of


fuzzy sets Ã, B̃ and C̃

Table 4.8 Fuzzy relation R̃ of fuzzy sets à and B̃


μ R̃ = Ã B̃
y1 y2 y3 y4 y5
x1 0.1 0.2 0 1 0.7
x2 0.3 0.5 0 0.2 1
x3 0.8 0 1 0.4 0.3

Table 4.9 Fuzzy relation S̃ of fuzzy sets B̃ and C̃


μ S̃ = B̃ C̃
z1 z2 z3 z4
y1 0.9 0 0.3 0.4
y2 0.2 1 0.8 0
y3 0.8 0 0.7 1
y4 0.4 0.2 0.3 0
y5 0 1 0 0.8

Table 4.10 Max-min fuzzy composition


μ R̃max-min S̃ = Ã C̃
z1 z2 z3 z4
x1 0.4 0.7 0.3 0.7
x2 0.3 1 0.5 0.8
x3 0.8 0.3 0.7 1

Example 4.3 Consider fuzzy relations R̃ and S̃ of three fuzzy sets Ã, B̃ and C̃ as
depicted in Fig. 4.3 having relational membership functions μ R̃ and μ S̃ given in
Tables 4.8 and 4.9.
Compute the max-min composition of the fuzzy relations.
Solution: The max-min composition of the fuzzy relations given in Tables 4.8
and 4.9 has been obtained using Eq. (4.8) and incorporated in Table 4.10.
4.4 Composition of Fuzzy Relations 85

For Example 4.3, C and MATLAB programming codes have been then incorpo-
rated in Programs 4.5 and 4.6, respectively.

Program 4.5: Write a C program for computing max-min composition of two given
fuzzy relations.

//Max-min composition
#include<stdio.h>
#include<conio.h>
int main()
{
int m,n,p,i,j,k;
float u1[5][5],u2[5][5],u3[5][5],c[10],max;
printf("Enter the number of elements in fuzzy set A:\n");
scanf("%d",&m);
printf("Enter the number of elements in fuzzy set B:\n");
scanf("%d",&n);
printf("Enter the number of elements in fuzzy set C:\n");
scanf("%d",&p);
printf("Enter the entries in fuzzy relational matrix R associated with fuzzy
sets A and B:\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
scanf("%f",&u1[i][j]);
}
}
printf("Enter the entries in fuzzy relational matrix S associated with fuzzy
sets B and C:\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=p;j++)
{
scanf("%f",&u2[i][j]);
}
}
//Performing max-min composition
for(i=1;i<=m;i++)
86 4 Fuzzy Relations

{
for(j=1;j<=p;j++)
{
for(k=1;k<=n;k++)
{
if(u1[i][k]<u2[k][j])
c[k]=u1[i][k];
else
c[k]=u2[k][j];
}
max=c[1];
for(k=2;k<=n;k++)
{
if(c[k]>max)
max=c[k];
}
u3[i][j]=max;
}
}
printf("\nThe max-min composition of fuzzy relational matrices R and S
is:\n");
for(i=1;i<=m;i++)
{

for(j=1;j<=p;j++)
{
printf("%10f",u3[i][j]);
}
printf("\n");
}
getch();
return 0;
}

Example 4.3 is then verified using Program 4.5 to obtain the max-min composition
of given fuzzy relations.

Input:
Enter the number of elements in fuzzy set A:
3
Enter the number of elements in fuzzy set B:
5
Enter the number of elements in fuzzy set C:
4
4.4 Composition of Fuzzy Relations 87

Enter the entries in fuzzy relational matrix R associated with fuzzy sets A and B:
0.1 0.2 0 1 0.7
0.3 0.5 0 0.2 1
0.8 0 1 0.4 0.3
Enter the entries in fuzzy relational matrix S associated with fuzzy sets B and C:
0.9 0 0.3 0.4
0.2 1 0.8 0
0.8 0 0.7 1
0.4 0.2 0.3 0
0 1 0 0.8

Output:
The max-min composition of fuzzy relational matrices R and S is:
0.400000 0.700000 0.300000 0.700000
0.300000 1.000000 0.500000 0.800000
0.800000 0.300000 0.700000 1.000000

The output window for Program 4.5 is further included in Fig. 4.4.

Fig. 4.4 Output of max-min composition of fuzzy relations R̃ and S̃


88 4 Fuzzy Relations

Program 4.6: Compute the max-min composition of two fuzzy relations using
MATLAB.

%Max-min composition
function maxmincomp
m = input('Enter the number of entries in fuzzy set A:\n');
n = input('Enter the number of entries in fuzzy set B:\n');
p = input('Enter the number of entries in fuzzy set C:\n');
% Enter the matrices R and S in matrix form
R = input('Enter the entries in fuzzy relational matrix R associated with fuzzy sets A
and B:\n');
S = input('Enter the entries in fuzzy relational matrix S associated with fuzzy sets B
and C:\n');
%Performing max-min composition
RoS=zeros(m,p);
for i=1:m
for k=1:p
for j=1:n
T(j)=min(R(i,j),S(j,k));
end
RoS(i,k)=max(T);
end
end
disp('The max-min composition of fuzzy relations R and S is:');
disp(RoS);
end

Further, using Program 4.6, the max-min composition of fuzzy relations given in
Example 4.3 is computed.

Input:
>> maxmincomp
Enter the number of entries in fuzzy set A:
3
Enter the number of entries in fuzzy set B:
5
Enter the number of entries in fuzzy set C:
4
Enter the entries in fuzzy relational matrix R associated with fuzzy sets A and B:
[0.1 0.2 0 1 0.7;0.3 0.5 0 0.2 1;0.8 0 1 0.4 0.3]
Enter the entries in fuzzy relational matrix S associated with fuzzy sets B and C:
[0.9 0 0.3 0.4;0.2 1 0.8 0;0.8 0 0.7 1;0.4 0.2 0.3 0;0 1 0 0.8]

Output:
The max-min composition of fuzzy relations R and S is:
0.4000 0.7000 0.3000 0.7000
0.3000 1.0000 0.5000 0.8000
0.8000 0.3000 0.7000 1.0000
4.4 Composition of Fuzzy Relations 89

Table 4.11 Fuzzy relation R̃ μ R̃ = Ã Ã


of Ã × Ã x1 x2 x3 x4 x5
x1 1 0.8 0 0.1 0.2
x2 0.8 1 0.4 0 0.9
x3 0 0.4 1 0 0
x4 0.1 0 0 1 0.5
x5 0.2 0.9 0 0.5 1

The characteristic property of relation in terms of reflexivity, symmetry, and transi-


tivity is possessed in classical relation. Similarly, fuzzy equivalence relation may be
developed with extension of the three properties for fuzzy sets. In this regard, the
fuzzy equivalence relation has been discussed in the next section.

4.5 Fuzzy Equivalence Relation

A relation R̃ ⊂ X̃ × X̃ is said to be fuzzy equivalence relation if the relational


membership function satisfies following conditions:
• Reflexivity: μ R̃ (xi , xi ) = 1, for xi ∈ X̃ ,
• Symmetry: μ R̃ (xi , x j ) = μ R̃ (x j , xi ) for xi , x j ∈ X̃ , and
• Transitivity: If μ R̃ (xi , x j ) = λ1 , μ R̃ (x j , xk ) = λ2 and μ R̃ (xi , xk ) = λ, then
λ ≥ min(λ1 , λ2 ).
An example for verifying the equivalence relation of a given fuzzy relation has
been considered in Example 4.4. Corresponding C and MATLAB program codes
have also been discussed in Programs 4.7 and 4.8, respectively.

Example 4.4 Consider a fuzzy relation R̃ of Ã × Ã as given in Table 4.11, having


relational membership function μ R̃ = (xi , x j ), where xi , x j ∈ X̃ . Verify whether
the fuzzy relation is an equivalence relation or not.
Solution: In order to verify the fuzzy equivalence relation, we need to check the
reflexivity, symmetry, and transitivity properties.
• Reflexivity: The reflexivity is satisfied as the diagonal entries in Table 4.11 contains
1 satisfying μ R̃ (xi , xi ) = 1, for xi ∈ X̃ .
• Symmetry: The relation is symmetric as the entries in lower and upper trian-
gular region contain corresponding equivalent values by satisfying μ R̃ (xi , x j ) =
μ R̃ (x j , xi ) for xi , x j ∈ X̃ .
• Transitivity: The relation is not transitive as λ ≥ min(λ1 , λ2 ) is not true ∀ xi , x j ∈
X̃ , where μ R̃ (xi , x j ) = λ1 , μ R̃ (x j , xk ) = λ2 and μ R̃ (xi , xk ) = λ.
For instance, λ < min(λ1 , λ2 ) when μ R̃ (x1 , x5 ) = 0.2, μ R̃ (x5 , x4 ) = 0.5 and
μ R̃ (x1 , x4 ) = 0.1.

Further, we have incorporated C and MATLAB programs for verification of fuzzy


equivalence relation.
90 4 Fuzzy Relations

Program 4.7: Verify whether the given relation is a fuzzy equivalence relation or
not using C program.

//Fuzzy equivalence relation


#include<stdio.h>
#include<conio.h>
float min(float a, float b)
{
int k;
float mn;
mn=a;

if(b<mn)
mn=b;
else
mn=a;
return mn;
}
int main()
{
int i,j,k,n,count,count1,count2;
count=0;
count1=0;
count2=0;
float R[10][10];
printf("Enter the number of elements in fuzzy set A:\n");
scanf("%d",&n);
printf("Enter the relational (%dx%d) matrix R associated with fuzzy set
A:\n",n,n);
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
scanf("%f",&R[i][j]);
}
for(i=1;i<=n;i++)
{
if(R[i][i]!=1)
{
count=1;
}
for(j=1;j<=n;j++)
{
if(R[i][j]!=R[j][i])
{
count1=1;
}
for(k=1;k<=n;k++)
{
4.5 Fuzzy Equivalence Relation 91

if(min(R[i][j],R[j][k])>R[i][k])
count2=1;
}
}
}
if(count==0)
printf("\nThe relation is a reflexive relation\n");
else
printf("\nThe relation is not a reflexive relation\n");
if (count1==0)
printf("\nThe relation is a symmetric relation\n");
else
printf("\nThe relation is not a symmetric relation\n");
if (count2==0)
printf("\nThe relation is a transitive relation\n");
else
printf("\nThe relation is not a transitive relation\n");
//Checking tolerance or equivalence relation
if(count==0&&count1==0&&count2==0)
printf("\nThe relation is tolerance and equivalence relation\n");
if(count==0&&count1==0&&count2!=0)
printf("\nThe relation is a tolerance relation but not an equivalence
relation\n");
getch();
return 0;
}
Using Program 4.7, Example 4.4 is then verified for fuzzy equivalence relation.

Input:
Enter the number of elements in fuzzy set A:
5
Enter the relational (5x5) matrix R associated with fuzzy set A:
1 0.8 0 0.1 0.2
0.8 1 0.4 0 0.9
0 0.4 1 0 0
0.1 0 0 1 0.5
0.2 0.9 0 0.5 1
Output:
The relation is a reflexive relation
The relation is a symmetric relation
The relation is not a transitive relation
The relation is a tolerance relation but not an equivalence relation

Output window after execution of Program 4.7 is depicted in Fig. 4.5.


92 4 Fuzzy Relations

Fig. 4.5 Output of fuzzy equivalence relation

Program 4.8: Write a MATLAB function for verifying fuzzy equivalence relation.

%Fuzzy equivalence relation


function equivalence
n = input('Enter the number of entries in fuzzy set A:\n');
% Enter the matrix R in matrix form
R = input('Enter the relational matrix R for the entries of A:\n');
count=0;
count1=0;
count2=0;
for i=1:n
if(R(i,i)~=1)
count=1;
end
for j=1:n
if(R(i,j)~=R(j,i))
count1=1;
end
for k=1:n
if(R(i,j)*R(j,k)>R(i,k))
count2=1;
end
end
end
end
if(count==0)
disp( 'The relation is a reflexive relation');
else
disp( 'The relation is not a reflexive relation');
end
if (count1==0)
disp( 'The relation is a symmetric relation');
4.5 Fuzzy Equivalence Relation 93

else
disp('The relation is not a symmetric relation');
end
if (count2==0)
disp('The relation is a transitive relation');
else
disp('The relation is not a transitive relation');
end
%Checking tolerance or equivalence relation
if(count==0&&count1==0&&count2==0)
disp('The relation is a tolerance and equivalence relation');
end
if(count==0&&count1==0&&count2~=0)
disp('The relation is a tolerance relation but not an equivalence relation');
end
end

Program 4.8 is then executed to verify whether the fuzzy relation given in Example
4.4 is a fuzzy equivalence relation.

Input:
>> equivalence
Enter the number of entries in fuzzy set A:
5
Enter the relational matrix R for the entries of A:
[1 0.8 0 0.1 0.2;0.8 1 0.4 0 0.9;0 0.4 1 0 0;0.1 0 0 1 0.5;0.2 0.9 0 0.5 1]

Output:
The relation is a reflexive relation
The relation is a symmetric relation
The relation is not a transitive relation
The relation is a tolerance relation but not an equivalence relation

Few unsolved questions have also been provided next for self-evaluation. More-
over, readers are encouraged to refer the books viz. Dubois and Prade (1980), Zim-
merman (2001), Lee (2006) and, Klir and Yuan (2008) for further knowledge of
fuzzy relations.
Exercise
1. Generate two relations for given fuzzy sets and compute the union, intersection,
and complement of the fuzzy relations using programming.
2. Write a C/MATLAB program for finding the containment of two relations R̃ and
S̃ as given in Example 4.1.
3. Write a MATLAB program to compute different projections (viz., first, second,
third, and total projections) for three fuzzy relations.
94 4 Fuzzy Relations

4. Write a C/MATLAB program for computing the max-product composition for


two given relations R̃ and S̃ as given in Example 4.3.
5. Compute the max-average composition for two given relations R̃ and S̃ as given
in Example 4.3.
6. Generate relation for a given fuzzy set and verify whether the relation is a toler-
ance relation or an equivalence relation.

References

D.J. Dubois, H. Prade, Fuzzy Sets and Systems: Theory and Applications, vol. 144 (Academic Press,
New York, 1980), pp. 68–94
G.J. Klir, B. Yuan, Fuzzy Sets and Fuzzy Logic, Theory and Applications (Prentice Hall, London,
2008)
K.H. Lee, First course on fuzzy theory and applications (Springer, New York, 2006)
H.J. Zimmerman, Fuzzy Set Theory and Its Applications (Springer, New York, 2001)
Chapter 5
Fuzzy Functions

In Chap. 4, the concept of crisp relation was extended to fuzzy relations, and here, the
notion of crisp function has been extended to fuzzy functions. Further, based on the
fuzzy parameters, different types of fuzzy functions are illustrated. In particular, this
chapter discusses the concept of fuzzy functions based on crisp relations along with
the concepts of single and fuzzy bunch of crisp functions. Moreover, C or MATLAB
codes related to fuzzy functions have also been included in this chapter.
Before proceeding with the notion of fuzzy function, we briefly recapitulate the
concept of crisp function in the next section.

5.1 Preliminaries of Crisp Function

A crisp function is a relation between elements of two classical sets X and Y . In


other words, a function f is a mapping from domain X to co-domain Y :

f:X → Y
x → f (x) = y

such that ∃ a unique image of dependent variable y ∈ Y for each independent variable
x ∈ X.
As regards, the propagation of uncertainty in function or in the domain and co-
domain associated with the functions yield the existence of fuzzy functions that have
been discussed in detail in the next section.

© Springer Nature Singapore Pte Ltd. 2019 95


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_5
96 5 Fuzzy Functions

5.2 Preliminaries of Fuzzy Function

A fuzzy function is defined as a mapping from fuzzy domain X̃ to co-domain Ỹ ,

f˜ : X̃ → Ỹ
x̃ → f˜(x̃) = ỹ

such that ∃ a unique fuzzified image ỹ ∈ Ỹ for each independent fuzzy variable
x̃ ∈ X̃ . Based on the fuzziness induced in the crisp functions, either in terms of
fuzzy function f˜ or domain X̃ or co-domain Ỹ , the fuzzy functions may be classified
into three types depending on following three cases (Lee 2006):
• Case I: The associated function f is crisp with fuzzy constraint (induced due to
fuzzy domain X̃ and co-domain Ỹ ).
• Case II: The function f is crisp with fuzzy domain X̃ .
• Case III: The function f˜ exhibit fuzziness over a crisp domain X .
The next section illustrates the three different kinds of fuzzy functions based on
the above cases.

5.3 Types of Fuzzy Function

Fuzzy function is classified into three types according to the propagation of fuzziness:
• Type I fuzzy function,
• Type II fuzzy function, and
• Type III fuzzy function.

5.3.1 Type I Fuzzy Function

Let us consider two crisp sets X , Y and two fuzzy sets Ã, B̃ with respect to the
universal sets X , Y , respectively, such that

à = {(x, μ à (x)) | μ à (x) ∈ [0, 1] and x ∈ X }

and

B̃ = {(y, μ B̃ (y)) | μ B̃ (y) ∈ [0, 1] and y ∈ Y }.


5.3 Types of Fuzzy Function 97

Then, a crisp function f : X → Y that takes the fuzzy set à to B̃ having mem-
bership values μ Ã (x) and μ B̃ (y) is referred as type I fuzzy function or crisp function
with fuzzy constraint, if it satisfies the membership relation,

μ Ã (x) ≤ μ B̃ (y). (5.1)

Here, type I fuzzy function propagates the fuzziness of crisp function associated
with a fuzzy constraint from domain X to co-domain Y . Next, we illustrate the
concept of crisp function with fuzzy constraint using an example problem.

Example 5.1 Let us consider two fuzzy sets à =


{(1, 0.2), (2, 0.5), (3, 0.7), (4, 0.3)} and B̃ = {(1, 0.5), (3, 0.7), (5, 0.9), (7, 1)}
with respect to universal sets X , Y , respectively, induced with crisp function
f (x) = 2x − 1 where x ∈ X and y ∈ Y . Verify whether the given function is a type
I fuzzy function or not.

Solution: With respect to the fuzzy set à = {(1, 0.2), (2, 0.5), (3, 0.7), (4, 0.3)},
x ∈ X takes the corresponding values from the set A = {1, 2, 3, 4} ⊂ X . Then,
using function f (x) = 2x − 1, the corresponding values in range set are obtained
as B = {1, 3, 5, 7} ⊂ Y . Using Eq. (5.1), we verify that μ Ã (x) ≤ μ B̃ (y) ∀x ∈
{1, 2, 3, 4} and ∀y ∈ {1, 3, 5, 7}. As such, the function f (x) = 2x − 1 is a type I
fuzzy function.
In this regard, a C program has been presented to illustrate the computational
verification of type I fuzzy function in Program 5.1.
Program 5.1: Write a C program for verification of type I fuzzy function.

//Type I fuzzy function


#include<stdio.h>
#include<conio.h>
int main()
{
int c=0,n,i,j;
double a[n],mua[n],b[n],mub[n];
printf("Enter the number of elements in the fuzzy domain Af\n");
scanf("%d",&n);
printf("Enter the set A for the fuzzy domain Af=(x,mu(x)) where x is
contained in A\n");
for(i=1;i<=n;i++)
scanf("%f",&a[i]);
printf("Enter the membership values mu(x) for the fuzzy domain
Af=(x,mu(x))\n");
for(i=1;i<=n;i++)
scanf("%f",&mua[i]);
printf("Enter the number of elements in the fuzzy co-domain Bf\n");
98 5 Fuzzy Functions

scanf("%d",&n);
printf("Enter the set B for the fuzzy domain Bf=(y,mu(y)) where y is
contained in B\n");
for(i=1;i<=n;i++)
scanf("%f",&b[i]);
printf("Enter the membership values mu(y) for the fuzzy domain
Bf=(y,mu(y))\n");
for(i=1;i<=n;i++)
scanf("%f",&mub[i]);
for(i=1;i<n;i++)
{
for(j=1;j<n;j++)
{
if((b[i]/2)==a[j])
{
if(mua[i]>mub[i])
{
c++;
}
}
}
}
if(c>0)
printf("The given function is not a type-I fuzzy function\n");
else
printf("The given function is a type-I fuzzy function\n");
getch();
return 0;
}

Using Program 5.1, the output with respect to Example 5.1 is obtained.

Input:
Enter the number of elements in the fuzzy domain Af
4
Enter the set A for the fuzzy domain Af=(x,mu(x)) where x is contained in A
1234
Enter the membership values mu(x) for the fuzzy domain Af=(x,mu(x))
0.2 0.5 0.7 0.3
Enter the number of elements in the fuzzy co-domain Bf
4
Enter the set B for the fuzzy domain Bf=(y,mu(y)) where y is contained in B
1357
Enter the membership values mu(y) for the fuzzy domain Bf=(y,mu(y))
0.5 0.7 0.9 1

Output:
The given function is a type-I fuzzy function
5.3 Types of Fuzzy Function 99

Fig. 5.1 Type I fuzzy function verification

Further, the output window corresponding to the abovementioned output has been
depicted in Fig. 5.1.
Then, we have discussed the type II fuzzy function in the next section.

5.3.2 Type II Fuzzy Function

Crisp function that propagates independent fuzzy variables to dependent fuzzy vari-
ables are referred as type II fuzzy function.
Let X , Y be two crisp sets and f : X → Y be the crisp function. Then, the fuzziness
of independent variables x̃ ∈ Ã is propagated to dependent variables y ∈ B using the
extension principle (discussed in Chap. 2) for the membership function as follows:

⎨ sup μx̃ (x), f −1 (y) = φ
μ B̃ (y) = x∈ f −1 (y) (5.2)
⎩ 0, f −1 (y) = φ.

Now, for the better understanding of type II fuzzy set, Example 5.2 has been
considered.

Example 5.2 Let us consider a crisp function y = f (x) = 5x 2 − 1 associated with


fuzzy domain à = {(−1, 0.3), (0, 0.8), (1, 0.5), (2, 0.9), (3, 0.4)}. Compute the
propagated fuzzy set B̃ associated with the crisp set B ⊂ Y having range [−10, 50]
using type II fuzzy function.

Solution: Crisp set A ⊂ X associated with fuzzy set à is

A = {−1, 0, 1, 2, 3}

and the crisp range set B ⊂ Y with respect to crisp constraint f (x) = 5x 2 − 1 is

B = {−1, 4, 19, 44}.


100 5 Fuzzy Functions

Using Eq. (5.2), the propagated fuzzy set with respect to fuzzy domain à =
{(−1, 0.3), (0, 0.8), (1, 0.5), (2, 0.9), (3, 0.4)} is obtained as illustrated below.

μ B̃ (−1) = sup{0.8} = 0.8,


μ B̃ (4) = sup{0.3, 0.5} = 0.5,
μ B̃ (19) = sup{0.9} = 0.9
and μ B̃ (44) = sup{0.4} = 0.4.

So, the fuzzy range set B̃ is obtained as {(−1, 0.8), (4, 0.5), (19, 0.9), (44, 0.4)}.
We have included MATLAB program to illustrate the computational usage of type
II fuzzy sets to obtain the propagated fuzzy set with respect to crisp function and
fuzzy domain in Programs 5.2.
Program 5.2: Write MATLAB function “type II” that computes fuzzy set B̃ due to
the propagation of fuzzy set à using a user input crisp function.

%Type II fuzzy function


function typeII
%Type II fuzzy function
%Inputs are a fuzzy set 'Af' and crisp function 'func'
%Fuzzy set Af={(x,mu(x)|x in A contained in universal set X)
n = input('Enter the number of elements in fuzzy set Af\n');
x = input('Enter n elements in A\n');
mux = input('Enter n membership values of x\n');
temp = zeros(n,n);
%B=func(A)
func = @(x) (5.*x.^2)-1;
y = func(x);
n=length(y);
disp('The fuzzy set Bf using extension principle is:');
yk = unique(y);
p = length(yk);
for k=1:p
mx = 0;
for i=1:n
if (y(i) == yk(k))
mx = max(mux(i),mx);
end
end
muy(k)=mx;
end
disp([yk' muy']);
end

Then, the output corresponding to Example 5.2 is obtained using Program 5.2 as
mentioned in the command window.
5.3 Types of Fuzzy Function 101

Input:
>> typeII
Enter the number of elements in fuzzy set Af
5
Enter n elements in A
[–1, 0, 1, 2, 3]
Enter n membership values of x
[0.3, 0.8, 0.5, 0.9, 0.4]

Output:
Enter the number of elements in fuzzy set Af
5
Enter n elements in A
[–1 0 1 2 3]
Enter n membership values of x
[0.3 0.8 0.5 0.9 0.4]
The fuzzy set Bf using extension principle is:
–1.0000 0.8000
4.0000 0.5000
19.0000 0.9000
44.0000 0.4000

The next section illustrates the third type of fuzzy function that consists of a fuzzy
function defined over a crisp domain.

5.3.3 Type III Fuzzy Function

The type III fuzzy function comprises a fuzzy function from crisp domain to co-
domain. As such, the fuzziness of the fuzzy function is propagated resulting in fuzzy
range set. Depending on the fuzzy function, there exist two classifications of type III
fuzzy function:
1. Single fuzzy function and
2. Fuzzy bunch of functions.
102 5 Fuzzy Functions

5.3.3.1 Single Fuzzy Function

A single fuzzy function is a fuzzy mapping:

f˜: X → P̃(Y ). (5.3)

Here, f˜ is the fuzzifying function over crisp domain X that propagates the fuzzi-
ness to the co-domain resulting in fuzzy co-domain P̃(Y ). To illustrate the fuzzy
propagation in Type III fuzzy function, we have considered an example problem in
Example 5.3.

Example 5.3 Let us consider two crisp sets:

A = {1, 2, 3, 4} and B = {2, 3, 4, 5, 6, 7, 8, 9, 12, 16}.

Solution: The power set of the fuzzy image may be considered as

P̃(B) = { B̃1 , B̃2 , B̃3 , B̃4 }

where B1 = {2, 4, 6}, B2 = {3, 5, 7}, B3 = {3, 6, 9, 12} and B4 = {4, 8, 12, 16}.
So, the associated fuzzifying function f˜ maps the crisp elements in A ⊂ X to the
power set P̃(B) ⊂ P̃(Y ). Accordingly, we may interpret,

f˜(1) = B̃1 = {(2, 0.1), (4, 0.5), (6, 1)},


f˜(2) = B̃2 = {(3, 0.5), (5, 1), (7, 0.3)},
f˜(3) = B̃3 = {(3, 0.3), (6, 0.5), (9, 1), (12, 0.4)}
and f˜(4) = B̃1 = {(4, 0.5), (8, 0.7), (12, 0.3), (16, 1)}.

5.3.3.2 Fuzzy Bunch of Functions

A set of crisp functions f i : X → Y for i = 1, 2, . . . , n is referred as fuzzy bunch of


functions

f˜ = {( f i , μ f˜ ( f i ))| f i : X → Y } (5.4)

having membership values μ f˜ (x)( f i ) for i = 1, 2, . . . , n.


Then, a solved example has been incorporated to implement the usage of fuzzy
bunch of functions.

Example 5.4 Consider a set of the crisp functions { f 1 , f 2 , f 3 , f 4 } such that

fi : X → Y
5.3 Types of Fuzzy Function 103

where ∀x ∈ X = {−2, 0, 1, 3, 4}, f 1 (x) = x + 1, f 2 (x) = x 2 + 2, f 3 (x) = 2x 3 and


f 4 (x) = x − 1. Compute the fuzzy bunch of functions f˜ such that
 
f˜ = f˜1 , f˜2 , f˜3 , f˜4 = {( f 1 , 0.2), ( f 2 , 0.1), ( f 3 , 0.4), ( f 4 , 1)}.

Solution: The fuzzy functions f˜i corresponding to crisp functions f i are obtained
for:

• f1 : f˜1 = {(−1, 0.2), (1, 0.2), (2, 0.2), (4, 0.2), (5, 0.2)},
• f2 : f˜2 = {(6, 0.1), (2, 0.1), (3, 0.1), (11, 0.1), (18, 0.1)},
• f3 : f˜3 = {(−16, 0.4), (0, 0.4), (2, 0.4), (54, 0.4), (128, 0.4)}, and
• f4 : f˜4 = {(−3, 1), (1, 1), (0, 1), (2, 1), (3, 1)}.

As such, the fuzzy images of the set {−2, 0, 1, 3, 4} corresponding to fuzzy func-
tions are
f˜(−2) = {(−1, 0.2), (6, 0.1), (−16, 0.4), (−3, 1)} = {(−16, 0.4), (−3, 1), (−1, 0.2), (6, 0.1)},
f˜(0) = {(1, 0.2), (2, 0.1), (0, 0.4), (1, 1)} = {(0, 0.4), (2, 0.1), (1, 1)},
f˜(1) = {(2, 0.2), (3, 0.1), (2, 0.4), (0, 1)} = {(0, 1), (2, 0.4), (3, 0.1)},
f˜(3) = {(4, 0.2), (11, 0.1), (54, 0.4), (2, 1)} = {(2, 1), (4, 0.2), (11, 0.1), (54, 0.4)}
and f˜(4) = {(5, 0.2), (18, 0.1), (128, 0.4), (3, 1)} = {(3, 1), (5, 0.2), (18, 0.1), (128, 0.4)}.

A similar approach may be applied for fuzzy bunch of continuous functions. Inter-
ested readers may refer Lee (2006) in this regard. Further, the readers are encouraged
to refer the books viz. Dubois and Prade (1980), Zimmerman (2001), and George
and Yuan (2008). Lastly, we have considered few problems for self-validation of the
readers.
Exercise:
1. Write a MATLAB program for the verification of type I fuzzy function.
2. Compute fuzzy set due to propagation of fuzzy set à =
{(−1, 0.3), (0, 0.8), (1, 0.5), (2, 0.9), (3, 0.4)} and crisp function

y = f (x) = 5x 2 − 1

using C programming.
3. Compute the fuzzy bunch of functions,

f˜ = {( f 1 , 0.2), ( f 2 , 0.1), ( f 3 , 0.4), ( f 4 , 1), ( f 5 , 0.3)},

where the crisp function f i : X → Y such that ∀x ∈ X = {−1, 0, 1, 2},


f 1 (x) = x − 2, f 2 (x) = x 2 + 2, f 3 (x) = x 2 , f 4 (x) = x 4 and f 5 (x) = x 4 − 1.
4. Write a MATLAB function “bunchf” to compute the fuzzy bunch of crisp func-
tions with respect to user input data.
104 5 Fuzzy Functions

References

D.J. Dubois, H. Prade, Fuzzy Sets and Systems: Theory and Applications, vol. 144 (Academic Press,
New York, 1980), pp. 68–94
J.K. George, Y. Bo, Fuzzy Sets and Fuzzy Logic, Theory and Applications (Prentice Hall, London,
2008)
K.H. Lee, First Course on Fuzzy Theory and Applications (Springer, New York, 2006)
H.J. Zimmerman, Fuzzy Set Theory and its Applications (Springer, New York, 2001)
Chapter 6
Fuzzy Differentiation and Integration

Integration and differentiation are often considered as fundamentals in calculus. The


Riemannian integration of crisp function f (x) over limits a and b such that x ∈ [a, b]
is usually given by

b
f (x) d x. (6.1)
a

In the previous chapter, we have discussed various types of fuzzy functions. As


such, if the function f (x) possesses uncertainty, then Eq. (6.1) may be interpreted as
integration of fuzzy function (Dubois and Prade 1980; Zimmerman 2001) or fuzzy
integration. In this way, the notion of crisp differentiation (classical differentiation)
may be extended to differentiation of fuzzy function or fuzzy differentiation. So, this
chapter mainly focuses on fuzzy differentiation and integration discussed in Sects. 6.1
and 6.2, respectively.

6.1 Fuzzy Differentiation

The crisp differentiation has been extended to fuzzy differentiation in this section.
Similar to integration, the fuzzy differentiation

˜ d ˜ 
f (ã) = f (x) (6.2)
dx x∈ã

may also be considered of two types:


i. Differentiation of fuzzifying function f˜(x) at crisp point a and
ii. Differentiation of crisp function f (x) at fuzzy point ã.

© Springer Nature Singapore Pte Ltd. 2019 105


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_6
106 6 Fuzzy Differentiation and Integration

In this regard, we discuss the fuzzy differentiation in Sects. 6.1.1 and 6.1.2, respec-
tively.

6.1.1 Fuzzifying Function at Crisp Point

The differentiation of fuzzifying function,


     
f˜(x) = f 1 (x), µ f˜ ( f 1 ) , f 2 (x), µ f˜ ( f 2 ) , . . . , f n (x), µ f˜ ( f n ) ,

at a given crisp point a is defined as



˜ d ˜ 
f (a) = f (x) (6.3)
dx x∈a

and the corresponding membership values (Lee 2006) may be obtained using

µ f  (ã) (z) = max {µã (x)}. (6.4)


z= f (x)

In this regard, an example problem has been incorporated for the fuzzy differentiation
in Example 6.1.

Example 6.1 Find the differentiation of fuzzifying function

f˜(x) = {( f 1 (x), 0.1), ( f 2 (x), 0.4), ( f 3 (x), 0.9)},

where f 1 (x) = 2x, f 2 (x) = x 2 + 1, and f 3 (x) = 3x − 1 at crisp point a = 2.

Solution: The differentiation f i (x) for i = 1, 2, 3 is obtained as f 1 (x) = 2, f 2 (x) =


2x, and f 3 (x) = 3. Accordingly, the differentiations of f i (x) at crisp point a = 2
are f 1 (2) = 2, f 2 (2) = 4, and f 3 (2) = 3. Using extension principle and Eq. (6.4),
the fuzzy differentiation is computed as

d f˜(x) 
 = {(2, 0.1), (4, 0.4), (3, 0.9)}. (6.5)
dx 
x=2

Further, the fuzzy differentiation in case of fuzzifying function at crisp point has
been implemented using a MATLAB program in Program 6.1.

Program 6.1: Write a MATLAB function to compute differentiation of a fuzzifying


function at crisp point.
6.1 Fuzzy Differentiation 107

fuzzyfying function at crisp point.


% Fuzzified function over crisp limits
function fuzfuncdiff(a)
% a is the crisp point
syms x
n = input('Enter the number of elements in fuzzy bunch of functions\n');
f = input('Enter the associated fuzzy bunch of functions f(x)\n');
muf = input('Enter the corresponding membership values\n');
for i=1:n
funcdiff(i) = subs(diff(f(i)),x,a);
end
fk = unique(funcdiff);
p = length(fk);
disp('The fuzzy differentiation results to fuzzy function (f,mu(f))');
for k=1:p
mx = 0;
for i=1:n
if (funcdiff(i) == fk(k))
mx = max(muf(i),mx);
end
end
mufy(k)=mx;
end
disp(double([fk' mufy']));
end
Then, the fuzzy differentiation using Program 6.1 has been computed for Example
6.1.

Input:
>> fuzfuncdiff(2)
Enter the number of elements in fuzzy bunch of functions
3
Enter the associated fuzzy bunch of functions f(x)
[2*x, x^2+1, 3*x-1]
Enter the corresponding membership values
[0.1, 0.4, 0.9]

Output:
The fuzzy differentiation results to fuzzy function (f,mu(f))
[ 2, 0.1000]
[ 3, 0.9000]
[ 4, 0.4000]
108 6 Fuzzy Differentiation and Integration

6.1.2 Crisp Function at Fuzzy Point

The differentiation of crisp function at a given fuzzy point has been taken into con-
sideration. Using extension principle, the differentiation f  (x) at fuzzy point ã is
defined as

d 
f  (ã) = f (x) (6.6)
dx x∈ã

having corresponding membership value µ f  (ã) (z) = max {µã (x)}.


z= f (x)
We have incorporated a solved example to illustrate the principle of fuzzy differ-
entiation in terms of differentiation of crisp function at fuzzy point.

Example 6.2 Compute the differentiation of function f (x) = 4x 3 at fuzzy point


ã = {(−2, 0.2), (−1, 0.6), (0, 1), (1, 0.8), (2, 0.4)}.

Solution: The crisp differentiation of function f (x) = 4x 3 is f  (x) = 12x 2 .


Accordingly, the fuzzy differentiation at ã is obtained as

f  (ã) = {(48, 0.2), (12, 0.6), (0, 1), (12, 0.8), (48, 0.4)}.

Using Eq. (6.14), the differentiation results to

f  (ã) = {(0, 1), (12, 0.8), (48, 0.4)}.

Accordingly, a MATLAB program “cfuncdiff.m” has been written in Program 6.2


that computes the fuzzy differentiation in case of crisp function at fuzzy point.

Program 6.2: Compute differentiation of a crisp function at fuzzy point using MAT-
LAB program.

% Crisp function at fuzzy point limits


function cfuncdiff
syms x
f = input('Enter the crisp function\n');
a = input('Enter the elements of fuzzy point a\n');
n = length(a);
mua = input('Enter the respective membership values\n');
for i=1:n
funcdiff(i) = subs(diff(f),x,a(i));
muf(i) = mua(i);
end
fk = unique(funcdiff);
p = length(fk);
disp('The fuzzy differentiation results to fuzzy function (f,mu(f))');
6.1 Fuzzy Differentiation 109

for k=1:p
mx = 0;
for i=1:n
if (funcdiff(i) == fk(k))
mx = max(muf(i),mx);
end
end
mufy(k)=mx;
end
disp(double([fk' mufy']));
end
The fuzzy differentiation using Program 6.2 has been computed for Example 6.2.

Input:
>> cfuncdiff
Enter the crisp function
4*x^3
Enter the elements of fuzzy point a
[-2, -1, 0, 1, 2]
Enter the respective membership values
[0.2, 0.6, 1, 0.8, 0.4]

Output:
The fuzzy differentiation results to fuzzy function (f,mu(f))
[ 0, 1.0000]
[ 12, 0.8000]
[ 48, 0.4000]

In the next section, the other fundamental concept of fuzzy calculus has been
discussed, viz., fuzzy integration.

6.2 Fuzzy Integration

The crisp integration given in Eq. (6.1) comprises mainly two basic constituents,
viz., integrand f (x) and the integration domain [a, b] with limits a and b. Based on
these constituents, the fuzzy integration is classified into two categories:
i. Integration of fuzzifying function f˜(x) over crisp limits a and b, and
ii. Integration of crisp function f (x) over fuzzy limits ã and b̃,
and discussed in Sects. 6.1.1 and 6.1.2, respectively.
110 6 Fuzzy Differentiation and Integration

6.2.1 Fuzzifying Function Over Crisp Limits

If the integrand is a fuzzifying function


     
f˜(x) = f 1 (x), µ f˜ ( f 1 ) , f 2 (x), µ f˜ ( f 2 ) , . . . , f n (x), µ f˜ ( f n ) .

Then, integration of the fuzzifying function over crisp domain [a, b] is defined as

b
I˜(a, b) = f˜(x) d x. (6.7)
a

Initially, each function f i (x) for i = 1, 2, . . . , n is integrated over the crisp


domain,

b
Ii (a, b) = f i (x) d x. (6.8)
a

Then, the fuzzy integration is obtained by associating the corresponding mem-


bership values with respect to each f i (x). As such, the fuzzy integration may be
interpreted as
⎧⎛ b ⎞ ⎛ b ⎞ ⎛ b ⎞⎫
b ⎨    ⎬
f˜(x) d x = ⎝ f 1 (x) d x, µ f˜ ( f 1 )⎠, ⎝ f 2 (x) d x, µ f˜ ( f 1 )⎠, . . . , ⎝ f n (x) d x, µ f˜ ( f n )⎠ .
⎩ ⎭
a a a a
(6.9)
Let us illustrate the principle of fuzzy integration for fuzzifying function with
crisp limits using a solved example problem given in Example 6.3.

Example 6.3 Consider fuzzifying function,

f˜(x) = {( f 1 , 0.7), ( f 2 , 0.2), ( f 3 , 0.9), ( f 4 , 1)}, (6.10)

where f 1 = 2x 2 , f 2 = 2x − 1, f 3 = x −2 , and f 4 = x 3 − 4x 2 + 1. Compute the


integration of f˜(x) over crisp domain [1, 4].

Solution: Each function f i (x) for i = 1, 2, . . . , 4 is initially integrated over the


crisp domain [1, 4] as

4
f 1 (x) d x = 42, (6.11a)
1
6.2 Fuzzy Integration 111

4
f 2 (x) d x = 12, (6.11b)
1
4
f 3 (x) d x = 0.75, (6.11c)
1

and

4
f 4 (x) d x = −17.25. (6.11d)
1

Accordingly, the fuzzy integration is obtained using Eq. (6.9) as


⎧⎛ 4 ⎞ ⎛ 4 ⎞ ⎛ 4 ⎞ ⎛ 4 ⎞⎫
4 ⎨     ⎬
f˜(x) d x = ⎝ f 1 (x) d x, 0.7⎠, ⎝ f 2 (x) d x, 0.2⎠, ⎝ f 3 (x) d x, 0.9⎠, ⎝ f 4 (x) d x, 1⎠
⎩ ⎭
1 1 1 1 1
4
⇒ f˜(x) d x = {(42, 0.7), (12, 0.2), (0.75, 0.9), (−17.25, 1)}.
1

A MATLAB program for computation of fuzzy integration in case of fuzzifying


function over crisp domain is given in Program 6.3.

Program 6.3: Write a MATLAB function “fuzfuncint” to compute integration of


fuzzifying function over crisp limits.

% Fuzzifying function over crisp limits


function fuzfuncint(a,b)
% a and b are the crisp limits
syms x
n = input('Enter the number of elements in fuzzy bunch of functions\n');
for i=1:n
f = input('Enter the associated crisp function\n');
muf(i) = input('Enter the corresponding membership value\n');
funcint(i) = int(f,x,[a b]);
end
disp('The fuzzy integration results to fuzzy function (f,mu(f)):');
fprintf('{');
for i=1:n
fprintf('(%f,%f)\t',funcint(i),muf(i));
end
fprintf('}');
end
112 6 Fuzzy Differentiation and Integration

Then, using Program 6.3, the fuzzy integration of fuzzifying function given in
Example 6.3 is computed over crisp domain [1, 4].

Input:
>> fuzfuncint(1,4)
Enter the number of elements in fuzzy bunch of functions
4
Enter the associated crisp function
2*x^2
Enter the corresponding membership value
0.7
Enter the associated crisp function
2*x-1
Enter the corresponding membership value
0.2
Enter the associated crisp function
x^(-2)
Enter the corresponding membership value
0.9
Enter the associated crisp function
x^3-4*x^2+1
Enter the corresponding membership value
1
Output:
The fuzzy integration results to fuzzy function (f,mu(f)):
{(42.000000, 0.700000) (12.000000, 0.200000) (0.750000, 0.900000)
(-17.250000,1.000000)}

The other case of fuzzy integration with respect to integration of crisp function
over fuzzy domain has been considered in next section.

6.2.2 Crisp Function Over Fuzzy Limits

Here, the integrand is a crisp function f (x). Accordingly, the integration of the
function over fuzzy limits is defined as

b̃
I˜(ã, b̃) = f (x) d x (6.12)

6.2 Fuzzy Integration 113

and the corresponding membership values are obtained using (Lee 2006)

µ I˜(ã,b̃) (z) = max{min{µã (x), µb̃ (x)}}, (6.13)


z

b
where z = ai j f (t) dt . The principle of fuzzy integration corresponding to
Eq. (6.12) is illustrated in Example 6.4.

Example 6.4 Consider a crisp function f (x) = 3x − 4 and compute the inte-
gration of f (x) over fuzzy domain with respect to given fuzzy limits ã =
{(2, 0.8), (4, 0.4), (5, 0.6)} and b̃ = {(6, 0.1), (7, 0.5), (8.5, 0.9), (9, 0.4)}.

Solution: Integrate each function f i (x) for i = 1, 2, . . . , 4 over the crisp domain
[1, 4] as given in Table 6.1.

Accordingly, using Eq. (6.13) and Table 6.1, the fuzzy integration is then obtained
as

b̃
f (x) d x = {(12.5, 0.1), (22, 0.1), (28, 0.5), (32, 0.1), (37.5, 0.4),

(47.5, 0.5), (56.875, 0.6), (76.375, 0.8), (87.5)}.

In Example 6.4, if the crisp function is replaced with function f (x) = 3, then we
obtain

Table 6.1 Crisp integration (i, j) [ai , b j ] µ(z) =


z(a , b ) =
associated with fuzzy limits  b ji j min{µai (x), µb j (x)}
ai f (x) d x

(1, 1) [2, 6] 32 0.1


(1, 2) [2, 7] 47.5 0.5
(1, 3) [2, 8.5] 76.375 0.8
(1, 4) [2, 9] 87.5 0.7
(2, 1) [4, 6] 22 0.1
(2, 2) [4, 7] 37.5 0.4
(2, 3) [4, 8.5] 66.375 0.4
(2, 4) [4, 9] 77.5 0.4
(3, 1) [5, 6] 12.5 0.1
(3, 2) [5, 7] 28 0.5
(3, 3) [5, 8.5] 56.875 0.6
(3, 4) [5, 9] 68 0.4
114 6 Fuzzy Differentiation and Integration

b̃
f (x) d x = {(3, 0.1), (6, 0.5), (6, 0.1), (9, 0.4), (10.5, 0.6), (12, 0.4), (12.5, 0.1),

(13.5, 0.4), (15, 0.4), (15, 0.5), (19.5, 0.8), (21, 0.4)}. (6.14)
6 7 6 9
From Eq. (6.14), 4 f (x) d x = 5 f (x) d x = 6, 2 f (x) d x = 5 f (x) d x =
7 9
12, and 2 f (x) d x = 4 f (x) d x = 15. In such cases, where the integral values are
equivalent then, using Eq. (6.13), the corresponding membership value is obtained
as the maximum membership value. Accordingly, Eq. (6.14) results to

b̃
f (x) d x = {(3, 0.1), (6, 0.5), (9, 0.4), (10.5, 0.6), (12, 0.4), (13.5, 0.4),

(15, 0.5), (19.5, 0.8), (21, 0.4)}.

A MATLAB program has been incorporated in Program 6.4 to illustrate the imple-
mentation of fuzzy integration with crisp function over fuzzy limits.

Program 6.4: Write a MATLAB function to compute the fuzzy integration with
crisp function over fuzzy limits.

%Crisp function over fuzzy limits


function cfuncint
a = input('Enter the elements of lower fuzzy limit a\n');
n = length(a);
mua = input('Enter the respective membership values of the elements in lower fuzzy
limit\n');
b = input('Enter the elements of upper fuzzy limit b\n');
m = length(b);
mub = input('Enter the respective membership values of the elements in upper fuzzy
limit\n');
syms x
f = input('Enter the crisp function f(x)\n');
for i=1:n
for j=1:m
z(i,j)=int(f,x,[a(i) b(j)]);
mu(i,j)=min(mua(i),mub(j));
end
end
zk = unique(z);
p = length(zk);
for k=1:p
mx = 0;
for i=1:n
6.2 Fuzzy Integration 115

for j=1:m
if (z(i,j) == zk(k))
mx = max(mu(i,j),mx);
end
end
end
muz(k)=mx;
end
disp('The integral values (z) and the respective membership values (mu(z)) are:');
disp(double([zk, muz']));
end

Using Program 6.4, the integration of crisp function over fuzzy domain has
been obtained for the crisp function f (x) = 3 over fuzzy domain with limits
ã = {(2, 0.8), (4, 0.4), (5, 0.6)} and b̃ = {(6, 0.1), (7, 0.5), (8.5, 0.9), (9, 0.4)}.

Input:
>> cfuncint
Enter the elements of lower fuzzy limit a
[2, 4, 5]
Enter the respective membership values of the elements in lower fuzzy limit
[0.8, 0.4, 0.6]
Enter the elements of upper fuzzy limit b
[6, 7, 8.5, 9]
Enter the respective membership values of the elements in upper fuzzy limit
[0.1, 0.5, 0.9, 0.4]
Enter the crisp function f(x)
3

Output:
The integral values (z) and the respective membership values (mu(z)) are:
3.0000 0.1000
6.0000 0.5000
9.0000 0.4000
10.5000 0.6000
12.0000 0.4000
13.5000 0.4000
15.0000 0.5000
19.5000 0.8000
21.0000 0.4000

Finally, few unsolved problems are included below for self-validation of the read-
ers.
116 6 Fuzzy Differentiation and Integration

Exercise

1. Compute the integration of function f (x) = 4x 3 + 3x 2 − 5 at


fuzzy limits ã = {(−2, 0.2), (1, 0.4), (2, 1), (4, 0.8)} and b̃ =
{(5, 0.4), (6, 0.3), (7, 0.8), (8, 0.8)}.
2. Write a C program for fuzzy differentiation of a given crisp function at a given
fuzzy point.

References

D.J. Dubois, H. Prade, Fuzzy Sets and Systems: Theory and Applications, vol. 144 (Academic Press,
New York, 1980), pp. 68–94
K.H. Lee, First Course on Fuzzy Theory and Applications (Springer, New York, 2006)
H.J. Zimmerman, Fuzzy Set Theory and Its Applications (Springer, New York, 2001)
Chapter 7
Defuzzification

The practical problems occurring in various engineering disciplines often include


imprecision as mentioned in Introduction section of Frontmatter of this book. Due
to the involvement of such uncertainties, the parameters considered in real-world
problems may be expressed as fuzzy sets instead of crisp sets. The methodology of
transformation of a crisp set to appropriate fuzzy set is referred as fuzzification. On the
other hand, defuzzification may be considered as an inverse approach of fuzzification
that converts fuzzy set to appropriate crisp set. Fuzzification and defuzzification are
often encountered in handling fuzzy logic controllers. Detailed discussion on fuzzy
controllers based on fuzzification and/or defuzzification modules may be found in
various literature (Klir and Yuan 2008; Zimmermann 1996; Hellendoorn and Thomas
1993).
In this regard, we define defuzzification as the transformation T,

T : X × [0, 1] → X,
  
where A = (x, µ A(x))µ A(x) ∈ [0, 1], x ∈ X is the fuzzy set and the transformed
crisp set is A. In case of defuzzification of a fuzzy number to corresponding crisp
value, the transformation is considered as

T :  × [0, 1] → 
ã → T (ã) = x ∗

While handling the practical problems with impreciseness, we often encounter


situations where the control command may be considered as a crisp value instead of
the concerned fuzzy number ã. In such cases, defuzzification helps in computation
of a crisp value x ∗ associated with the fuzzy number ã as given in Fig. 7.1.

© Springer Nature Singapore Pte Ltd. 2019 117


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_7
118 7 Defuzzification

Fig. 7.1 Defuzzification of


fuzzy set ã

But there exists no specific approach for the choice of defuzzified crisp value;
instead, the defuzzification method needs to be selected with respect to the system
of the practical problem. Various defuzzification methods exist and may be found in
Zimmermann (2001), Lee (2006) and Sivanandam and Deepa (2012). In this chapter,
we have mainly discussed four types of defuzzification, viz., max-membership, cen-
troid methods, weighted-average, and mean–max methods. Further, MATLAB pro-
grams with respect to the defuzzification methods have also been included in the
present context.
In this regard, the defuzzification methods have been discussed in the next section.

7.1 Defuzzification Methods

The max-membership, centroid, weighted-average, and mean–max methods of


defuzzification have been incorporated in Sects. 7.1.2–7.1.5. However, before we
start with the different defuzzification procedures, we briefly discuss the concept of
aggregation (Lee 2006; Sivanandam and Deepa 2012) of fuzzy sets (required while
performing defuzzification for multiple fuzzy sets).

7.1.1 Aggregation

Aggregation helps in computation of a single fuzzy set with respect to multiple


fuzzy sets. Sivanandam and Deepa (2012) discussed two aggregation rules, viz.,
conjunctive and disjunctive based on fuzzy intersection and union (given in Chap.
2), respectively, that may be useful in handling fuzzy reasoning. In this chapter, we
have focused on the aggregation in terms of fuzzy union as shown in Fig. 7.2.
A MATLAB code has been included in Program 7.1 to perform the aggregation
of multiple fuzzy sets using a fuzzy union.
7.1 Defuzzification Methods 119

Fig. 7.2 Aggregated fuzzy



set C

Program 7.1: Write a MATLAB function “aggregate” to perform aggregation of


fuzzy sets.

%Aggregation of fuzzy sets


function [x,mf] = aggregate(n)
%n is the number of fuzzy sets
% Enter values of the fuzzy numbers TFN,TrFN and GFN
x =[-10:0.1:10]'; %x values
for i=1:n
fprintf('Enter the fuzzy set %d\n',i);
j = input('Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy
sets\n');
if(j==1)
tfn = input('Enter a TFN (a,b,c)\n');
yt(i,:) = trimf(x,[tfn(1) tfn(2) tfn(3)]);
a(i) = input('Enter membership scaling factor in interval [0,1] for triangular
type fuzzy set\n');
yt(i,:) = a(i)*yt(i,:);
elseif(j==2)
trfn = input('Enter a TrFN (a,b,c,d)\n');
yt(i,:) = trapmf(x,[trfn(1) trfn(2) trfn(3) trfn(4)]);
b(i) = input('Enter membership scaling factor in interval [0,1] for trapezoial
type fuzzy set\n');
yt(i,:) = b(i)*yt(i,:);
elseif(j==3)
gfn = input('Enter a GFN (a,b,c)\n');
yt(i,:) = gauss2mf(x,[gfn(2) gfn(1) gfn(3) gfn(1)]);
c(i) = input('Enter membership scaling factor in interval [0,1] for Gaussian type
fuzzy set\n');
yt(i,:) = c(i)*yt(i,:);
end
end
120 7 Defuzzification

%Aggregate the fuzzy sets


for i=1:n
yt(1,:) = max(yt(1,:),yt(i,:));
mf = yt(1,:);
end
plot(x,mf,'-r','LineWidth',2)
xlabel('x')
ylabel('\mu(x)')
ylim([-0.05 1.05])
end

Using Program 7.1, the aggregated fuzzy set with respect to four fuzzy sets is
obtained and the corresponding MATLAB plot is depicted in Fig. 7.3.

Input:
>> aggregate(4)
Enter the fuzzy set 1
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
1
Enter a TFN (a,b,c)
[-7, -5, 1]
Enter membership scaling factor between 0 to 1 for triangular type fuzzy set
0.5
Enter the fuzzy set 2
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
2
Enter a TrFN (a,b,c,d)
[-3, 1, 5, 6]
Enter membership scaling factor between 0 to 1 for trapezoial type fuzzy set
0.9
Enter the fuzzy set 3
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
2
Enter a TrFN (a,b,c,d)
[5, 6, 8, 9]
Enter membership scaling factor between 0 to 1 for trapezoial type fuzzy set
1
Enter the fuzzy set 4
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
3
Enter a GFN (a,b,c)
[-2, 3, 4]
Enter membership scaling factor between 0 to 1 for Gaussian type fuzzy set
0.7

Output:
7.1 Defuzzification Methods 121

Fig. 7.3 Aggregated fuzzy


output

Using the aggregation rule as illustrated in Program 7.1, the max-membership


defuzzification of fuzzy sets is discussed in the next section.

7.1.2 Max-Membership Method

The max-membership method gives the defuzzified point as the crisp value x ∗ ∈ X
having maximum membership value ∀x ∈ X . In this regard, the membership or
characteristic value corresponding to defuzzified point x ∗ ∈ X satisfies

µC(x ∗ ) ≥ µC(x) ∀x ∈ X (7.1)

or µC(x ∗ ) = sup (µC(x)). (7.2)


x∈X

Sometimes, this method is also referred as height method as the defuzzification is


performed based on the maximum height as given in Eq. (7.2). An example problem
has been considered in Example 7.1 to illustrate the max-membership method.
Example 7.1 Compute defuzzification of GFN ã = g f n(2, 1, 1) using max-
membership method.
Solution: The GFN ã = g f n(2, 1, 1) as given in Fig. 7.4 has the membership
function
 (x−2)2
e− 2 ,x <2
µã (x) = 2 .
− (x−2)
e 2 ,x ≥2
122 7 Defuzzification

Fig. 7.4 Gaussian fuzzy


number

Using Eq. (7.2), the GFN attends its maximum membership value 1 at x = 2.
Accordingly, the defuzzified crisp value x ∗ is 2.
In order to make max-membership method effective, we have written a MATLAB
code for computation of defuzzified crisp value in Program 7.2.

Program 7.2: Write a “maxmem” MATLAB function to perform defuzzification


using max-membership method.

%Max-membership defuzzification
function maxmem(n)
%n is the number of fuzzy sets
%mf is the membership function of aggregated fuzzy set
[x,mf] = aggregate(n);
maxm = max(mf);
p = length(mf);
z = 0;
for i = 1:p
if(mf(i) == maxm)
z = x(i);
end
end
disp('The defuzzified crisp value is:');
disp(z);
end

Using Program 7.2, defuzzification of fuzzy set using max-membership function


for three fuzzy set is obtained.
7.1 Defuzzification Methods 123

Input:
>> maxmem(2)
Enter the fuzzy set 1
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
3
Enter a GFN (a,b,c)
[-5, 2, 3]
Enter membership scaling factor in interval [0,1] for Gaussian type fuzzy set
0.8
Enter the fuzzy set 2
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
1
Enter a TFN (a,b,c)
[-2, 2, 7]
Enter membership scaling factor in interval [0,1] for triangular type fuzzy set
1

Output:
The defuzzified crisp value is:
2

The corresponding plot depicting defuzzification using max-membership method


has been given in Fig. 7.5.

Fig. 7.5 Defuzzification


using max-membership
method
124 7 Defuzzification

7.1.3 Centroid Method

Here, we find x ∗ ∈ X using the relation



µc̃ (x) · x d x
x∗ =  . (7.3)
µc̃ (x) d x

It may be noted that the integration is the usual algebraic integration. Accordingly,
based on Eq. (7.3), MATLAB code for performing defuzzification using centroid
method has been given in Program 7.3.

Program 7.3: Write a MATLAB function “fcentroid” to perform defuzzification


using centroid method.

%Centroid defuzzification
function fcentroid(n)
%n is the number of fuzzy sets
%mf is the membership function of aggregated fuzzy set
z = 0;
[x,mf] = aggregate(n);
nx = length(x);
z = (sum(mf(1:nx).*x(1:nx))/(sum(mf(1:nx))));
disp('The defuzzified crisp value is:');
disp(z);
end

Using Program 7.3, the defuzzification of fuzzy set is obtained at x ∗ = −2.9882


using centroid method.

Input:
>> fcentroid(3)
Enter the fuzzy set 1
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
1
Enter a TFN (a,b,c)
[4, 5, 6]
Enter membership scaling factor in interval [0,1] for triangular type fuzzy set
0.2
Enter the fuzzy set 2
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
2
7.1 Defuzzification Methods 125

Enter a TrFN (a,b,c,d)


[-9, -6, -2, 2]
Enter membership scaling factor in interval [0,1] for trapezoial type fuzzy set
0.9
Enter the fuzzy set 3
Select 1 for triangular or 2 for trapezoidal or 3 for Gaussian fuzzy sets
3
Enter a GFN (a,b,c)
[-1,2,3]
Enter membership scaling factor in interval [0,1] for Gaussian type fuzzy set
0.4

Output:
The defuzzified crisp value is:
-2.9882

Accordingly, the defuzzification using centroid method with respect to Program


7.3 has been depicted in Fig. 7.6.
There exist already various predefined MATLAB functions to perform defuzzifi-
cation. The defuzzification centroid technique in Program 7.3 may also be obtained
by MATLAB command “z = defuzz(x,mf,‘centroid’)” to obtain the defuzzification
point, where “mf” is the corresponding membership values with respect to “x”.
It is worth mentioning that defuzzification using above command “z =
defuzz(x,mf,‘centroid’)” yields equivalent crisp value as obtained using Program
7.3. There exist various other methods, viz., weighted-average and mean–max meth-
ods discussed in Sects. 7.1.4 and 7.1.5.

Fig. 7.6 Defuzzification


using centroid method
126 7 Defuzzification

7.1.4 Weighted-Average Method

Here, we have x ∗ ∈ X as
n
i=1 µC ( x̄ i ) · x̄ i
x∗ =  n , (7.5)
i=1 µC ( x̄ i )

where x̄i is the centroid of maximum for each ith membership function of the aggre-
gated fuzzy set.
n
Further, i=1 represents the algebraic sum with respect to membership functions
of n fuzzy sets. The method seems appealing but has a limitation that it may be
applicable only in case of fuzzy sets having symmetric membership functions.

7.1.5 Mean–Max Method

Mean–max defuzzification method is also sometimes termed as middle of maxima


as given in Fig. 7.7.
The corresponding defuzzified crisp value is obtained using

a+b
x∗ = . (7.5)
2
MATLAB command to obtain the defuzzification point using mean–max method
is “z = defuzz(x,mf,‘mom’)”, where “mf” is the aggregated membership function
corresponding to “x”.
There exist various other defuzzification methods. Readers may refer defuzzi-
fication commands in MATLAB for the other defuzzification techniques based on
bisector, middle, smallest, and largest of maximum methods.
Exercise
1. Define MATLAB function “wedavg” to compute defuzzification of fuzzy set
using weighted-average method.

Fig. 7.7 Defuzzification


using mean–max method
7.1 Defuzzification Methods 127

2. Write a MATLAB function “meanmax” to implement the weighted-average


defuzzification technique for a given fuzzy set.

References

H. Hellendoorn, C. Thomas, Defuzzification in fuzzy controllers. J. Intell. Fuzzy Syst. 1(2), 109–123
(1993)
G.J. Klir, B. Yuan, Fuzzy Sets and Fuzzy Logic, Theory and Applications (Prentice Hall, London,
2008)
K.H. Lee, First Course on Fuzzy Theory and Applications (Springer, New York, 2006)
S.N. Sivanandam, S.N. Deepa, Principles of Soft Computing (Wiley India Pvt. Ltd., New Delhi,
2012)
H.J. Zimmermann, Fuzzy control, in Fuzzy Set Theory—And Its Applications (Springer, Dordrecht,
1996), pp. 203–240
H.J. Zimmermann, Fuzzy Set Theory and Its Applications (Springer, New York, 2001)
Chapter 8
Interval System of Linear Equations

Differential equations serve as the backbone of various science and engineering


problems viz. structure analysis, control theory, image processing, circuit analysis,
robotics, etc. and there exist variety of methods for solving such differential equa-
tions. Generally, under static conditions, the governing differential equations get
converted to system of equations. But in actual practice, as a result of errors in mea-
surements, observations, calculations, or due to maintenance induced errors, etc., the
differential equations and the corresponding system of equations may have uncer-
tain parameters that may be handled using probabilistic approach, interval analysis,
and fuzzy set theory. Unfortunately, the probabilistic approach may not deliver reli-
able results at the required precision without sufficient experimental data. As such,
interval analysis and fuzzy set theory serve as powerful tools for handling uncer-
tain parameters or values having infimum and supremum. In Chap. 1, the notion of
interval matrix has been introduced and as such, this chapter deals with application
of interval matrices for solving interval system of linear equations (ISLEs). Further,
the chapter includes certain solved numerical examples along with MATLAB codes
and also consists of few unsolved problems for self-evaluation.

8.1 System of Linear Equations

System of equations is of great importance in solving practical problems of various


engineering fields to obtain the values of unknown parameter vector x. For instance, in
structural analysis, system of equations helps in computation of nodal displacements
for defined structures. Also, in circuit analysis problem V = IR, system of equations
helps in computation of current I based on known voltage V and resistance R. When
the dependency between the parameters in any physical system is linear, then such
system of equations is referred as system of linear equations. Generally, a system of
linear equation is formulated as

© Springer Nature Singapore Pte Ltd. 2019 129


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_8
130 8 Interval System of Linear Equations

Ax = b, (8.1)

where A is the linear relation coefficient matrix having dimension m × n, b is the right-
hand side vector having m elements, and x is the solution vector having n variables.
But due to insufficiency and incompleteness of data, the parameters in such system
of equations may be uncertain which leads to uncertain system of linear equations.
According to Chaps. 1 and 3, the uncertainty may be handled using interval analysis
and fuzzy set approaches.
Note: Any fuzzy system of linear equations may be converted into appropriate ISLEs
since a fuzzy number is approximately represented by a set of closed intervals using
α-cut.

8.2 Interval System of Equations

System of equations having interval uncertainties is referred as interval system of


equations. Now, the ISLE is defined as

[A][x] = [b], (8.2)

where [A] is the linear interval coefficient matrix having dimension m × n, [b] is the
interval vector of size m, and [x] is the corresponding solution vector consisting of n
variables. Further, Eq. (8.2) may be written as


n
[ai j ] = [bi ].
j=1

Rohn (1989) discussed the computation of solution ISLE, in terms of x i =


min{xi |xi ∈ [x]} and x̄i = max{xi |xi ∈ [x]} (Kreinovich et al. 2013) that is generally
non-convex in nature. In case of narrow intervals, Kahl (1996) discussed that solving
such an ISLE is NP-hard. There also exist few algebraic or formal (Shary 2002)
and numerical Neumaier (1990) solution approaches (Hansen 1969; Chakraverty
et al. 2017). As such, three cases based on the solution procedure discussed in (Das
and Chakraverty 2012) with respect to vertex approach have been considered in
Sect. 8.2.1.

8.2.1 Methods for Solving ISLEs

Let us consider n × n ISLE as given in Eq. (8.2).


8.2 Interval System of Equations 131
⎛ ⎞⎧ ⎫ ⎧ ⎫
[a11 ] [a12 ] . . . [a1n ] ⎪⎪ [x1 ] ⎪
⎪ ⎪
⎪ [b1 ] ⎪

⎜ [a21 ] [a22 ] . . . [a2n ] ⎟⎪
⎨ ⎬ ⎪
⎪ ⎨ [b2 ] ⎪

⎜ ⎟ [x2 ]
⎜ . . . . ⎟ . = . . (8.3)
⎝ .. .. . . .. ⎠⎪ ⎪ .. ⎪⎪ ⎪
⎪ .. ⎪⎪

⎩ ⎭ ⎪
⎪ ⎩ ⎪

[an1 ] [an2 ] . . . [ann ] [xn ] [bn ]

Then, Eq. (8.3) is further written as

[a11 ][x1 ] + [a12 ][x2 ] + . . . [a1n ][xn ] = [b1 ]


[a21 ][x1 ] + [a22 ][x2 ] + . . . [a2n ][xn ] = [b2 ]
.. . (8.4)
.
[an1 ][x1 ] + [an2 ][x2 ] + . . . [ann ][xn ] = [bn ]

In terms of lower and upper bounds, Eq. (8.4) may be written as

[a 11 , ā 11 ][x 1 , x̄ 1 ] + [a 12 , ā 12 ][x 2 , x̄ 2 ] + . . . + [a 1n , ā 1n ][x n , x̄ n ] = [b1 , b̄1 ]


[a 21 , ā 21 ][x 1 , x̄ 1 ] + [a 22 , ā 22 ][x 2 , x̄ 2 ] + . . . + [a 2n , ā 2n ][x n , x̄ n ] = [b2 , b̄2 ]
.. .
.
[a n1 , ā n1 ][x 1 , x̄ 1 ] + [a n2 , ā n2 ][x 2 , x̄ 2 ] + . . . + [a nn , ā nn ][x n , x̄ n ] = [bn , b̄n ]
(8.5)

8.2.1.1 Method I

If the elements of coefficient interval matrix [A] in Eq. (8.5) are positive, that is,
∀a i j , āi j ∈ + for i, j = 1, 2, . . . , n, and then Eq. (8.5) may be further written as

a 11 x 1 + a 12 x 2 + . . . + a 1n x n = b1
a 21 x 1 + a 22 x 2 + . . . + a 2n x n = b2
.. , (8.6a)
.
a n1 x 1 + a n2 x 11 + . . . + a nn x 11 = bn
ā11 x̄ 1 + ā12 x̄ 2 + . . . + ā1n x̄ n = b̄1
ā21 x̄ 1 + ā22 x̄ 2 + . . . + ā2n x̄ n = b̄2
.. . (8.6b)
.
ān1 x̄ 1 + ān2 x̄ 2 + . . . + ānn x̄ n = b̄n

In terms of interval matrix notation, Eqs. (8.6a, 8.6b) is given as


132 8 Interval System of Linear Equations
⎛ ⎞⎧ ⎫ ⎧ ⎫
a 11 a 12 . . . a 1n 0 0 ... 0 ⎪ ⎪ x1 ⎪ ⎪ ⎪
⎪ b1 ⎪⎪
⎜a ⎪ ⎪ ⎪ ⎪
⎜ 21 a 22 . . . a 2n 0 0 ... 0 ⎟ ⎟⎪

⎪ x ⎪




⎪ b ⎪


⎟⎪ ⎪ ⎪ ⎪
2 2
⎜ . .. ⎪
⎪ . ⎪
⎪ ⎪
⎪ . ⎪

⎜ .. . ⎟⎪ .
⎪ . ⎪ ⎪
⎪ ⎪ ⎪ .
. ⎪

⎜ ⎟⎪ ⎪ ⎪
⎜ ⎪
⎟⎨ ⎬ ⎨ ⎪ ⎪ ⎪ ⎬
⎜ a n1 a n2 . . . a nn 0 0 . . . 0 ⎟ xn bn
⎜ ⎟ = . (8.7)
⎜ 0 0 . . . 0 ā11 ā12 . . . ā1n ⎟⎪ x̄1 ⎪ ⎪ b̄1 ⎪
⎜ ⎟⎪⎪
⎪ x̄ ⎪


⎪ ⎪


⎪ b̄ ⎪



⎜ 0 0 . . . 0 ā21 ā22 . . . ā2n ⎟ ⎪
⎜ ⎟⎪⎪
⎪ . ⎪
2⎪
⎪ ⎪
⎪ 2⎪
⎪ . ⎪ ⎪
⎜ .. .. ⎟⎪ ⎪ ⎪
⎪ . ⎪
⎝ . . ⎠⎪⎪
⎪ .. ⎪⎪ ⎪
⎪ ⎪ . ⎪



⎩ ⎭ ⎩ ⎪⎪ ⎪ ⎭
0 0 . . . 0 ān1 ān2 . . . ānn x̄n b̄n

Accordingly, it may be noted that the ISLE in Eq. (8.3) gets converted to crisp
system of linear equations having double dimension. For instance, in case of a 2 ×
2 ISLE, Eq. (8.7) gets reduced to 4 × 4 crisp system of linear equation as
⎛ ⎞⎧ ⎫ ⎧ ⎫
a 11 a 12 0 0 ⎪ ⎪ x ⎪ ⎪ b ⎪
⎜a ⎨ 1⎪ ⎬ ⎪⎨ 1⎪ ⎬
⎜ 21 a 22 0 0 ⎟⎟ x b
⎝ 0
2 = 2 . (8.8)
0 ā11 ā12 ⎠⎪
⎪ x̄ ⎪ ⎪ b̄ ⎪
⎩ 1⎪ ⎭ ⎪⎩ 1⎪ ⎭
0 0 ā21 ā22 x̄2 b̄2

Now, there exists a unique solution to Eq. (8.8) as given below:

a 22 b1 − a 12 b2
x1 = , (8.9a)
a 11 a 22 − a 12 a 21
ā22 b̄1 − ā12 b̄2
x̄1 = , (8.9b)
ā11 ā22 − ā12 ā21
a b − a 21 b1
x 2 = 11 2 , (8.9c)
a 11 a 22 − a 12 a 21
ā11 b̄2 − a 21 b̄1
x2 = . (8.9d)
ā11 ā22 − ā12 ā21

Example 8.1 Let us consider a 2 ×2 ISLE [A][x] = [b] as given in (Chakraverty


et al. 2017),
    
[4, 6] [5, 8] [x 1 , x̄1 ] [40, 67]
= , (8.10)
[6, 7] [4, 5] [x 2 , x̄2 ] [43, 55]
   
[4, 6] [5, 8] [40, 67]
where [A] = and [b] = .
[6, 7] [4, 5] [43, 55]

Solution: Using Eqs. (8.8), (8.10) gets converted to crisp system of linear equations.
8.2 Interval System of Equations 133

⎛ ⎞⎧ ⎫ ⎧ ⎫
4 5 0 0 ⎪ ⎪ x ⎪ ⎪ 40 ⎪
⎜6 ⎨ 1⎪ ⎬ ⎪⎨ ⎪ ⎬
⎜ 4 0 0⎟⎟ x 43
⎝0
2 = .
0 6 8 ⎠⎪⎪ x̄ ⎪ ⎪ 67 ⎪
⎩ 1⎪ ⎭ ⎪⎩ ⎪ ⎭
0 0 7 5 x̄2 55

Accordingly, using Eqs. (8.9a, 8.9b, 8.9c, and 8.9d), the bounds of solution vector
are obtained as [x1 ] = [3.9286, 4.0385] and [x2 ] = [4.8571, 5.3462].

Program 8.1: MATLAB program for solving interval system of linear equations
using Eq. (8.8).

%Interval system of linear equations


%Enter the dimension of system of linear equations
n = input('Enter the dimension of coefficient matrix A');
%Enter the lower and upper bounds of coefficient matrix A
Al = input('Enter the lower bound of each element of interval aij: \n ');
Au = input('Enter the upper bound of each element of interval aij: \n ');
%Enter the lower and upper bounds of right-hand side vector
bl = input('Enter the lower bounds of interval vector b:\n ');
bu = input('Enter the upper bounds of interval vector b:\n ');
%Crisp system of linear equations
disp('The crisp coefficient matrix is');
O=zeros(n);
A=[Al O;O Au]
disp('The crisp right-hand side vector is');
b=[bl;bu]
x=inv(A)*b
Using Program 8.1, the interval system of linear equations given in Example 8.1
has been solved.

Input:
Enter the dimension of coefficient matrix A
2
Enter the lower bound of each element of interval aij:
[4 5; 6 4]
Enter the upper bound of each element of interval aij:
[6 8;7 5]
Enter the lower bounds of interval vector b:
[40;43]
Enter the upper bounds of interval vector b:
[67;55]
134 8 Interval System of Linear Equations

Output:
The crisp coefficient matrix is
A= 4 5 0 0
6 4 0 0
0 0 6 8
0 0 7 5
The crisp right-hand side vector is
b = 40
43
67
55

x= 3.9286
4.8571
4.0385
5.3462

8.2.1.2 Method II

Equation (8.8) may further be written in terms of lower and upper bounds, systems
of linear equations as given below:
    
a 11 a 12 x1 b1
,= (8.11a)
a 21 a 22 x2 b2
    
ā11 ā12 x̄1 b̄1
= . (8.11b)
ā21 ā22 x̄2 b̄2

On solving, Eqs. (8.11a, 8.11b) yields

a 22 b1 − a 12 b2
x1 = ,
a 11 a 22 − a 12 a 21
ā22 b̄1 − ā12 b̄2
x̄1 = ,
ā11 ā22 − ā12 ā21
a b − a 21 b1
x 2 = 11 2 ,
a 11 a 22 − a 12 a 21
ā11 b̄2 − ā21 b̄1
x̄2 = ,
ā11 ā22 − ā12 ā21

which is equivalent to Eqs. (8.9a, 8.9b, 8.9c, and 8.9d).


8.2 Interval System of Equations 135

Program 8.2: A MATLAB program for solving interval system of linear equations
using Eqs. (8.11a, 8.11b).

%Interval system of linear equations


%Enter the dimension of system of linear equations
n = input('Enter the dimension of coefficient matrix A\n');
%Enter the lower and upper bounds of coefficient matrix A
Al = input('Enter the lower bound of each element of interval aij: \n ');
Au = input('Enter the upper bound of each element of interval aij: \n ');
%Enter the lower and upper bounds of right-hand side vector
bl = input('Enter the lower bounds of interval vector b:\n ');
bu = input('Enter the upper bounds of interval vector b:\n ');
%Solution bounds
disp('The lower and upper bounds of solution vector x');
xl=inv(Al)*bl
xu=inv(Au)*bu
Accordingly, the output with respect to Example 8.1 has been obtained using
Program 8.2.

Input:
Enter the dimension of coefficient matrix A
2
Enter the lower bound of each element of interval aij:
[4 5; 6 4]
Enter the lower bound of each element of interval aij:
[6 8;7 5]
Enter the upper bounds of interval vector b:
[40;43]
Enter the upper bounds of interval vector b:
[67;55]

Output:
The lower and upper bounds of solution vector x
xl = 3.9286
4.8571
xu = 4.0385
5.3462

8.2.1.3 Method III

If the elements of coefficient interval matrix [A] are either positive or negative, that
is, ∀a i j , āi j ∈ + or a i j , āi j ∈ − for i, j = 1, 2, . . . , n.
136 8 Interval System of Linear Equations

Substituting [ci j , c̄i j ] = −[a i j , āi j ] if a i j , āi j ∈ − for i, j = 1, 2, . . . , n,


Eq. (8.5) is rewritten as

[a 11 , ā 11 ][x 1 , x̄ 1 ] − [c12 , c̄12 ][x 2 , x̄ 2 ] + . . . + [a 1n , ā 1n ][x n , x̄ n ] = [b1 , b̄1 ]


−[c21 , c̄21 ][x 1 , x̄ 1 ] + [c22 , c̄22 ][x 2 , x̄ 2 ] + . . . − [c2n , c̄2n ][x n , x̄ n ] = [b2 , b̄2 ]
.. .
.
[a n1 , ā n1 ][x 1 , x̄ 1 ] − [cn2 , c̄n2 ][x 2 , x̄ 2 ] + . . . + [a nn , ā nn ][x n , x̄ n ] = [bn , b̄n ]
(8.12)

Now, using matrix multiplication of intervals, [a i j , āi j ][x i , x̄i ] is rewritten as


[āi j x i , a i j x̄i ]. So, in terms of interval matrix notation, Eq. (8.12) is given by
⎛ ⎞⎧ ⎫ ⎧ ⎫
a 11 ā12 . . . a 1n 0 0 . . . 0 ⎪ ⎪ x ⎪ ⎪ b ⎪
⎜ ā a . . . ā ⎪ 1⎪
⎟⎪ ⎪ ⎪
⎪ ⎪ 1⎪
⎪ ⎪

⎜ 21 22 0 0 . . . 0 ⎪
⎟⎪ x ⎪
2⎪

⎪ b ⎪
2⎪
⎜ .
2n
⎟⎪
⎪ ⎪
⎪ ⎪
⎪ ⎪

⎜ .. .
.. ⎪
⎟⎪ .
.. ⎪⎪ ⎪
⎪ .
.. ⎪

⎜ ⎟⎪
⎪ ⎪
⎪ ⎪
⎪ ⎪

⎜ ⎟⎪
⎨ ⎪ ⎬ ⎪ ⎨ ⎪ ⎬
⎜ a n1 ān2 . . . a nn 0 0 . . . 0 ⎟ x n bn
⎜ ⎟ = . (8.13)
⎜ 0 0 . . . 0 ā11 a 12 . . . ā1n ⎟⎪ x̄1 ⎪ ⎪ b̄1 ⎪
⎜ ⎟⎪

⎪ x̄ ⎪


⎪ ⎪


⎪ b̄ ⎪



⎜ 0 0 . . . 0 a 21 ā22 . . . a 2n ⎟⎪
⎜ ⎟⎪

⎪ . ⎪
2⎪
⎪ ⎪
⎪ 2⎪
⎪ . ⎪ ⎪
⎜ .. .. ⎟⎪ ⎪ ⎪
⎪ . ⎪
⎝ . . ⎠⎪

⎪ .. ⎪
⎪ ⎪
⎪ ⎪

. ⎪


⎩ ⎭ ⎩ ⎪⎪ ⎪ ⎭
0 0 . . . 0 ān1 a n2 . . . ānn x̄n b̄n

Example 8.2 Let us now consider an application problem of a three-stepped fixed-


free bar as given in Fig. 8.1 having force [P3 ] applied on the free end (Behera
and Chakraverty 2013). The interval values of the material parameters of the three-
stepped bar element viz. Young’s modulus [E i ], area [Ai ], and length [L i ] for i =
1, 2, 3 are considered in Table 8.1.

Fig. 8.1 A three-stepped bar with force applied at the free end
8.2 Interval System of Equations 137

Table 8.1 Interval values of Parameters Interval values


parameters of the
three-stepped bar [A1 ](in.2 ) [2.99, 3.01]

[A2 ](in.2 ) [1.99, 2.01]

[A3 ](in.2 ) [0.99, 1.01]

[L 1 ](in.) [11.95, 12.05]


[L 2 ](in.) [9.95, 10.05]
[L 3 ](in.) [5.95, 6.05]
[E 1 ], [E 2 ], [E 3 ]( psi) [2.8, 3.1]
[P3 ](lb) [7500, 12500]

Table 8.2 Interval i Translational displacements


translational displacements of
[u i ] ui ū i
2 1.0794 × 104 1.6007 × 104
3 2.4323 × 104 3.5969 × 104
4 4.0691 ×104 5.9724 ×104

Solution: Using finite element method for the three-stepped bar under static con-
dition yields the interval system of equation as given in (Behera and Chakraverty
2013)
⎛ ⎞
[1.2492, 1.4071] −[0.5544, 0.6262] 0
⎝ −[0.5544, 0.6262] [1.0126, 1.1524] −[0.4582, 0.5262] ⎠
0 −[0.4582, 0.5262] [0.4582, 0.5262]
⎧ ⎫ ⎧ ⎫ .
⎨ [u 2 , ū 2 ] ⎬ ⎨ 0 ⎬
× 107 [u 3 , ū 3 ] = 0 .
⎩ ⎭ ⎩ ⎭
[u 4 , ū 4 ] [7500, 12500]

Applying Method III, the interval translational displacements [u i ] at nodes 2, 3,


and 4 are computed and the results are given in Table 8.2.

Program 8.3: A MATLAB program for solving interval system of linear equations
using Method III.
138 8 Interval System of Linear Equations

%Interval system of linear equations


%Enter the dimension of system of linear equations
n = input('Enter the dimension of coefficient matrix A\n');
%Enter the lower and upper bounds of coefficient matrix A
Al = input('Enter the lower bound of each element of interval aij: \n ');
Au = input('Enter the upper bound of each element of interval aij: \n ');
%Enter the lower and upper bounds of right-hand side vector
bl = input('Enter the lower bounds of interval vector b:\n ');
bu = input('Enter the upper bounds of interval vector b:\n ');
for i=1:n
for j=1:n
if Au(i,j)<0
t=Al(i,j);
Al(i,j)=Au(i,j);
Au(i,j)=t;
end
end
end
%Crisp system of linear equations
disp('The crisp coefficient matrix is');
O=zeros(n);
A=[Al O;O Au];
disp('The crisp right-hand side vector is');
b=[bl;bu];
%Solution bounds
disp('The bounds of solution vector x');
x=inv(A)*b
Further, the output corresponding to Example 8.2 has been obtained and incorpo-
rated as given below:

Input:
Enter the dimension of coefficient matrix A
3
Enter the lower bound of each element of interval aij:
[1.2492 -0.6262 0;-0.6262 1.0126,-0.5262;0 -0.5262 0.4582]
Enter the upper bound of each element of interval aij:
[1.4071 -0.5544 0;-0.5544 1.1524 -0.4582; 0 -0.4582 0.5262]
Enter the lower bounds of interval vector b:
[0;0;7500]
Enter the upper bounds of interval vector b:
[0;0;12500]

Output:
The crisp coefficient matrix is
A = 1.2492 -0.5544 0 0 0 0
8.2 Interval System of Equations 139

-0.5544 1.0126 -0.4582 0 0 0


0 -0.4582 0.4582 0 0 0
0 0 0 1.4071 -0.6262 0
0 0 0 -0.6262 1.1524 -0.5262
0 0 0 0 -0.5262 0.5262
The crisp right-hand side vector is
b= 0
0
7500
0
0
12500
The bounds of solution vector x
x = 1.0e+004 *
1.0794
2.4323
4.0691
1.6007
3.5969
5.9724

The methods considered may not yield tighter interval bounds. Readers interested
in having more detail usage of various methods for solving interval system of linear
equations are encouraged to see the references Rohn (1989), Neumaier (1990) and
Chakraverty et al. (2017)
Similar procedures involving interval computations may be applied to solve fuzzy
system of linear equations using α-cut approach. As such, literature viz. (Abbasbandy
et al. 2006), (Behera and Chakraverty 2015), and the references mentioned therein
may be referred for solving fuzzy system of equations.
Exercise

1. Solve the ISLE [A][x] = [b], where the coefficient matrix and vector is given
by
   
[9, 11] −[3.9, 4.1] [26, 30]
[A] = and [b] = .
−[3.9, 4.1] [15, 16] [35, 39]

2. Generate MATLAB code for solving ISLE if 0 belongs to elements of coefficient


matrix [A].
140 8 Interval System of Linear Equations

References

S. Abbasbandy, E. Reza, J. Ahmad, LU decomposition method for solving fuzzy system of linear
equations. Appl. Math. Comput. 172, 633–643 (2006)
D. Behera, S. Chakraverty, Fuzzy finite element analysis of imprecisely defined structures with
fuzzy nodal force. Eng. Appl. Artif. Intell. 26(10), 2458–2466 (2013)
D. Behera, S. Chakraverty, New approach to solve fully fuzzy system of linear equations using
single and double parametric form of fuzzy numbers. Sadhana 40, 35–49 (2015)
S. Chakraverty, M. Hladík, N.R. Mahato, A sign function approach to solve algebraically interval
system of linear equations for nonnegative solutions. Fundam. Inform. 152, 13–31 (2017)
S. Das, S. Chakraverty, Numerical solution of interval and fuzzy system of linear equations. Appl.
Appl. Math. 7, 334–356 (2012)
E. Hansen, On the solution of linear algebraic equations with interval coefficients. Linear Algebra
Appl. 2, 153–165 (1969)
P.T. Kahl, Solving narrow-interval linear equation systems is NP-hard. MS thesis. University of
Texas at El Paso, 1996
V. Kreinovich, A.V. Lakeyev, J. Rohn, P.T. Kahl, Computational Complexity and Feasibility of Data
Processing and Interval Computations, vol. 10 (Springer, 2013)
A. Neumaier, Interval Methods for Systems of Equations, vol. 37 (Cambridge University Press,
1990)
J. Rohn, Systems of linear interval equations. Linear Algebr. Appl. 126, 39–78 (1989)
S.P. Shary, A new technique in systems analysis under interval uncertainty and ambiguity. Reliable
Comput. 8, 321–418 (2002)
Chapter 9
Interval Eigenvalue Problems

Engineering problems governed by interval differential equations under static and


dynamic conditions led to interval system of linear equations and interval eigenvalue
problems. Chapter 8 is dealt with solving interval system of linear equations using
interval analysis. As such, the aim of this chapter is to solve eigenvalue problems
having interval parameters.

9.1 Eigenvalue Problems

The eigenvalue problems are of the form

E(λ)x = 0

may be categorized into linear and nonlinear eigenvalue problems depending on the
linearity and nonlinearity of the eigenfunction E(λ), where λ is the eigenvalue and x
is the corresponding eigenvector. Linear eigenvalue problems are further categorized
into standard and generalized eigenvalue problems as discussed in Sects. 9.1.1 and
9.1.2. There exist variety of methods for solving standard (Gerald and Wheatley
2004; Bhat and Chakraverty 2004) and generalized eigenvalue problems (Humar
2012).
Eigenvalue problems play important role in solving many practical problems of
various science and engineering. For instance, in linear time-invariant systems, the
eigenvalues resemble respective poles of the transfer function. On the other hand, in
structural dynamics, eigenvalue problems help in identification of natural frequency
of a structural system. The governing eigenvalue problem in structural systems is
considered as

(Mλ2 + Cλ + K )x = 0, (9.1)

© Springer Nature Singapore Pte Ltd. 2019 141


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_9
142 9 Interval Eigenvalue Problems

where M, C, and K are the mass, damping, and stiffness matrices, respectively.
But, due to the presence of impreciseness in material properties of structural system,
Eq. (9.1) reduces to uncertain eigenvalue problems as

( M̃ λ̃2 + C̃ λ̃ + K̃ )x̃ = 0. (9.2)

Here, M̃, C̃, and K̃ are the uncertain mass, damping, and stiffness matrices,
respectively. As such, the standard and generalized eigenvalue problems have been
recapitulated in Sects. 9.1.1 and 9.1.2, respectively, whereas the uncertainty handling
in terms of interval eigenvalue problems has been considered in Sect. 9.2.

9.1.1 Standard Eigenvalue Problems

Standard eigenvalue problem is formulated as

E(λ)x = (A − λI )x = 0, (9.3)

where A is the n × n square matrix, λ is the eigenvalue (characteristic value), and x is


the corresponding right eigenvector (characteristic vector) associated with λ. Here,
I designates the identity matrix of dimension n × n.

Example 9.1 Compute the eigenvalues for


⎛⎡ ⎤ ⎡ ⎤⎞⎧ ⎫
2 −3 4 5 1 0 0 0 ⎪ x1 ⎪
⎪ ⎪
⎜⎢ −3 5 8 5⎥ ⎢0 1 0 0⎥ ⎟⎨ x2 ⎬
⎜⎢ ⎥ − λ⎢ ⎥⎟ = 0. (9.4)
⎝⎣ 1 6 9 8⎦ ⎣0 0 1 0 ⎦⎠⎪
⎪ x3 ⎪
⎩ ⎪ ⎭
3 −3 12 6 0 0 0 1 x4

Solution: Comparing Eq. (9.4) with (9.3), we have the coefficient matrix
⎡ ⎤
2 −3 4 5
⎢ −3 5 8 5⎥
A=⎢
⎣ 1
⎥.
6 9 8⎦
3 −3 12 6

The eigenvalues for Eq. (9.4) are obtained by solving the characteristic equation
as

det(A − λI ) = 0. (9.5)
9.1 Eigenvalue Problems 143

There exist variety of numerical methods viz. power method, subspace iteration,
Jacobi method, etc. (Gerald and Wheatley 2004; Bhat and Chakraverty 2004) that
may be used by the readers to solve (9.5) depending upon the problems. Accord-
ingly, the characteristic Eq. (9.5) for Example 9.1 reduces to λ4 − 22λ3 + 12λ2 +
524λ + 1365 = 0 resulting to eigenvalues 19.9007, 7.3872, −2.6439
√ + 1.5148i, and
−2.6439 − 1.5148i, where “i” is the imaginary number i = −1.

9.1.2 Generalized Eigenvalue Problems

Generalized eigenvalue problem is formulated as

E(λ)x = (A − λB)x = 0, (9.6)

where A, B are n ×n square matrices, λ is the eigenvalue (characteristic value) and x


is the corresponding right eigenvector of λ. The generalized eigenvalue problem given
in Eq. (9.6) may be converted to standard eigenvalue problem given in Eq. (9.3) as
(C − λI )x = (B −1 A − λI )x = 0, if B is a non-singular matrix. As such, sometimes
standard eigenvalue problems are also considered as special case of generalized
eigenvalue problem.

Example 9.2 Compute the eigenvalues for standard eigenvalue problem as


⎛⎡ ⎤ ⎡ ⎤⎞⎧ ⎫
2 −3 4 5 1 3 4 5 ⎪
⎪ x1 ⎪
⎜⎢ −3 ⎥ ⎢ ⎥ ⎟⎨ ⎪ ⎬
⎜⎢ 5 8 5⎥ 3 1 0 2 ⎥⎟ x2
⎝⎣ 1 − λ⎢ = 0. (9.7)
6 9 8⎦ ⎣4 2 1 −1 ⎦⎠⎪⎪ x ⎪
⎩ 3⎪ ⎭
3 −3 12 6 5 −1 −2 1 x4

Solution: Comparing Eq. (9.7) with (9.6), we have the coefficient matrices as
⎡ ⎤ ⎡ ⎤
2 −3 4 5 1 3 4 5
⎢ −3 5 8 5⎥ ⎢3 1 0 2 ⎥
A=⎢
⎣ 1
⎥ and B = ⎢ ⎥.
6 9 8⎦ ⎣4 2 1 −1 ⎦
3 −3 12 6 5 −1 −2 1

Here, the eigenvalues are obtained by solving the characteristic equation as

det(A − λB) = 0. (9.8)

resulting to eigenvalues 12.2622, −1.5873, −2.6439 + 1.5148i, and −2.6439 −


1.5148i.
144 9 Interval Eigenvalue Problems

In this regard, MATLAB codes have been given in Program 9.1 that computes the
eigenvalues and corresponding vectors for given characteristic equation (standard or
generalized eigenvalue problems).
Program 9.1: Compute the eigenvalue and eigenvectors for a user input characteristic
equation, (A − λI )x = 0 or (A − λB)x = 0 using MATLAB programming.

%Characteristic equation
A = input('Enter the elements of square matrix A corresponding eigen function (A-
lambda I)\n');
B = input('Enter the elements of square matrix B corresponding eigen function (A-
lambda B)\n');
I=eye(size(A));
disp('The eigenvalues and eigenvectors of (A-lambda I)x=0 are:')
%Eigenvalue and eigenvectors of (A-lambda I)x=0
%Ds is a diagonal matrix containing the eigenvalues
%Vs gives the column vector as respective eigenvectors
[Vs,Ds] = eig(A);
%eigvs is the vector containing all eigenvalues
eigvs = diag(Ds)
Vs
disp('The eigenvalues and eigenvectors of (A-lambda B)x=0 are:')
%Eigenvalue and eigenvectors of (A-lambda B)x=0
%Dg is a diagonal matrix containing the eigenvalues
%Vg gives the column vector as respective eigenvectors
[Vg,Dg] = eig(A,B);
%eigvg is the vector containing all eigenvalues
eigvg = diag(Dg)
Vg

Using Program 9.1, the standard and generalized eigenvalue problems considered
in Examples 9.1 and 9.2 are solved.

Input:
Enter the elements of square matrix A corresponding eigen function (A-lambda I)
[2, 3, –4, 5;–3, 5, 8, 5;1, 6, 9, 8;3, –3, 12, 6]
Enter the elements of square matrix B corresponding eigen function (A-lambda B)
[1, 3, 4, 5;3, 1, 0, 2;4, 2, 1, –1;5, –1, –2, 1]
9.1 Eigenvalue Problems 145

Output:
The eigenvalues and eigenvectors of (A-lambda I)x=0 are:
eigvs = 19.6358 + 0.0000i
6.1233 + 0.0000i
–1.8796 + 3.3262i
–1.8796 – 3.3262i
Vs = –0.0771 + 0.0000i –0.4346 + 0.0000i –0.6738 + 0.0000i –0.6738 + 0.0000i
–0.5279 + 0.0000i 0.6664 + 0.0000i –0.3071 – 0.2525i –0.3071 + 0.2525i
–0.6817 + 0.0000i 0.2697 + 0.0000i –0.2170 + 0.1833i –0.2170 – 0.1833i
–0.5007 + 0.0000i –0.5425 + 0.0000i 0.5335 – 0.1501i 0.5335 + 0.1501i
The eigenvalues and eigenvectors of (A-lambda B)x=0 are:
eigvg = 8.1182 + 0.0000i
–3.6383 + 0.0000i
0.6614 + 0.5869i
0.6614 – 0.5869i
Vg = –0.3114 + 0.0000i –0.3568 + 0.0000i 0.8074 + 0.1926i 0.8074 – 0.1926i
1.0000 + 0.0000i –0.5143 + 0.0000i 0.6465 + 0.2031i 0.6465 – 0.2031i
–0.5913 + 0.0000i 1.0000 + 0.0000i 0.3157 + 0.0316i 0.3157 – 0.0316i
0.0595 + 0.0000i –0.0597 + 0.0000i –0.5638 + 0.2625i –0.5638 – 0.2625i

Similarly, the nonlinear eigenvalue problems viz. polynomial eigenvalue problems


E(λ)x = (A0 + A1 λ + · · · + A p λ p )x = 0 may also be solved. Readers interested
in nonlinear eigenvalue problems may use the following MATLAB command “[x,
e] = polyeig(A0, A1, …, Ap)” for computation of eigenvalues e and eigenvectors x.
Next section deals with interval eigenvalue problems that handle uncertainty in
terms of closed intervals. Further, it is left to the readers to verify the interval approach
in solving uncertain (fuzzy) eigenvalue problems using α-cut.

9.2 Interval Eigenvalue Problems

The standard and generalized interval eigenvalue problems have been discussed in
this section. The standard interval eigenvalue problem compared to Eq. (9.3) is given
by

([A] − [λ][I ])[x] = 0, (9.9)

where [A] is the n × n interval square matrix (each entry resembles an interval),
[λ] is the interval eigenvalue and [x] is the corresponding interval eigenvectors. The
generalized interval eigenvalue problem associated with Eq. (9.6) is given by

([A] − [λ][B)[x] = 0, (9.10)


146 9 Interval Eigenvalue Problems

where [A], [B] are the n × n interval square matrices, [λ] is the interval eigenvalue,
and [x] is the corresponding interval bound of eigenvectors. Based on the classical
interval arithmetic discussed in Chap. 1, we may find variety of methods (Deif 1991;
Mahato and Chakraverty 2016a; Qiu et al. 2001) for solving Eqs. (9.9) and (9.10).
In this regard, vertex method has been discussed in detail in Sect. 9.2.1.

9.2.1 Vertex Method

The vertex method (Moore 1979) is referred to the computation of interval bounds
[ f , f¯] based on interval arithmetic with respect to constraint f (a, b) = 0, where
a ∈ [a], b ∈ [b] using all possible combinations of the vertex or end points
S f = { f (a, b) = 0 , f (a, b̄) = 0, f (ā, b) = 0, f (ā, b̄) = 0} , where

[ f , f¯] = [min{S f }, max{S f }]. (9.11)

As such, the vertex method in terms of interval eigenvalue problem ([A] −


[λ]I )[x] = 0 may yield the following constraints:

(A − λa I )x a = 0 and ( Ā − λb I )x b = 0. (9.12)

Then, the interval eigenvalue [λ] may be obtained using

[λ] = [λ, λ̄] = [min{λa , λb }, max{λa , λb }], (9.13)

and the respective eigenvector bounds may be obtained using

[x] = [x, x̄] = [min{xa , xb }, max{xa , xb }]. (9.14)

Here, (9.12) has been obtained with respect to the two vertex matrices (lower
A = (a i j ) and upper Ā = (āi j ) matrices for i, j = 1, 2, . . . , n) of [A].
Now, consider an interval eigenvalue problem in Example 9.3.

Example 9.3 Compute the bounds of eigenvalues using vertex method for the stan-
dard interval eigenvalue problem ([A] − [λ]I )[x] = 0, where interval coefficient
matrix is
⎡ ⎤
[1.05, 2.1] −[2.9, 3.2] [3.8, 4.2] [4.5, 5.2]
⎢ −[2.9, 3.2] [4.9, 5.2] [7.8, 8.2] [4.8, 5.3] ⎥
[A] = ⎢
⎣ [3.8, 4.2]
⎥.
[7.8, 8.2] [8.7, 9.2] [7.8, 8.1] ⎦
[4.5, 5.2] [4.8, 5.3] [7.8, 8.1] [5.8, 6.6]

Solution: Using Eq. (9.12), we obtain the two constraints as


9.2 Interval Eigenvalue Problems 147

⎛⎡ ⎤ ⎡ ⎤⎞
1.05 −3.2 3.8 4.5 1 0 0 0
⎜⎢ −3.2 4.9 7.8 4.8 ⎥ ⎢0 1 0 0⎥ ⎟
⎜⎢ ⎥ − λa ⎢ ⎥⎟ x a = 0 (9.15a)
⎝⎣ 3.8 7.8 8.7 7.8 ⎦ ⎣0 0 1 0 ⎠

4.5 4.8 7.8 5.8 0 0 0 1

and
⎛⎡ ⎤ ⎡ ⎤⎞
2.1 −2.9 4.2 5.2 1 0 0 0
⎜⎢ −2.9 5.2 8.2 ⎥
5.3 ⎥ ⎢ 0 1 0 0⎥ ⎟
⎜⎢ − λb ⎢ ⎥⎟x b = 0. (9.15b)
⎝⎣ 4.2 8.2 9.2 8.1 ⎦ ⎣0 0 1 0 ⎠

5.2 5.3 8.1 6.6 0 0 0 1

Further, using (9.13) the bounds of eigenvalues are obtained as −[5.4006, 5.5938],
−[0.7554, 1.0734], [6.0211, 6.5653], and [21.0961, 22.6907].
In this regard, a MATLAB program has been written to compute real eigenvalue
bounds of standard interval eigenvalue problems.
Program 9.3: Compute the eigenvalue and eigenvectors for characteristic equation,
([A] − [λ]I )[x] = 0 using MATLAB programming.

%Characteristic equation
Al = input('Enter the elements of lower square matrix ‘A’ corresponding eigen
function (Al-lambda I)\n');
Au = input('Enter the elements of upper square matrix ‘A’ corresponding eigen
function (Au-lambda I)\n');
I=eye(size(Al));
disp('The eigenvalues of ([Al,Au]-lambda I)x=0 are:')
l=eig(Al);
u=eig(Au);
el=min(l,u);
eu=max(l,u);
disp('The lower bounds of eigenvalues for ([Al,Au]-lambda I)x=0 are:')
el'
disp('The upper bounds of eigenvalues for ([Al,Au]-lambda I)x=0 are:')
eu'

Using Program 9.3, the standard interval eigenvalue problem considered in Exam-
ple 9.3 is solved.

Input:
Enter the elements of square matrix ‘A’ corresponding eigen function (Al-lambda I)
[1.05 –3.2 3.8 4.5; –3.2 4.9 7.8 4.8; 3.8 7.8 8.7 7.8; 4.5 4.8 7.8 5.8]
Enter the elements of square matrix ‘B’ corresponding eigen function (Au-lambda
B)
[2.1 –2.9 4.2 5.2;–2.9 5.2 8.2 5.3; 4.2 8.2 9.2 8.1;5.2 5.3 8.1 6.6]
148 9 Interval Eigenvalue Problems

Output:
The lower bounds of eigenvalues for ([Al,Au]-lambda I)x=0 are:
–5.5938 –1.0734 6.0211 21.0961

The upper bounds of eigenvalues for ([Al,Au]-lambda I)x=0 are:


–5.4006 –0.7554 6.5653 22.6907

In case of generalized interval eigenvalue problem ([A] − [λ][B])[x] = 0, the


vertex method yields

(A − λa B)x a = 0, (9.16a)

(A − λb B̄)x b = 0, (9.16b)

( Ā − λc B)x c = 0, (9.16c)

and

( Ā − λd B̄)x d = 0. (9.16d)

As such, the interval eigenvalue [λ] may be obtained using

[λ] = [λ, λ̄] = [min{λa , λb , λc , λd }, max{λa , λb , λc , λd }] (9.17)

and the corresponding eigenvector bounds may be obtained using

[x] = [x, x̄] = [min{xa , xb , xc , xd }, max{xa , xb , xc , xd }]. (9.18)

Depending on the order of the coefficient matrices in ([A] − [λ][B])[x] = 0,


vertex method may yield more constraints. As such, Eqs. (9.12) and (9.18) may not
yield tighter eigenvalue bounds. In Chap. 3, we have seen that the fuzzy numbers
may be converted to fuzzy intervals using α-cut. As such, the above method may
easily be extended to solve fuzzy eigenvalue problems. Readers interested in more
depth of interval eigenvalues problems are encouraged to refer Dief (1991), Qiu et al.
(2001), Mahato and Chakraverty (2016a, b) and the references mentioned therein.
For solving nonlinear interval eigenvalue problems, Chakraverty and Mahato (2018)
may be referred.
Next chapter focuses on another aspect of soft computing technique viz. artificial
neural network.
References 149

References

R.B. Bhat, S. Chakraverty, Numerical Analysis in Engineering (Narosa, Alpha Science International
Limited, Pangbourne, 2004)
S. Chakraverty, N.R. Mahato, Nonlinear interval eigenvalue problems for damped spring-mass
system. Eng. Comput. 35(6), 2272–2286 (2018)
A. Deif, The interval eigenvalue problem. Z. Angew. Math. Mech. 71, 61–64 (1991)
C.F. Gerald, P.O. Wheatley, Applied Numerical Analysis, 7th edn. (Pearson Education, New Delhi,
2004)
J. Humar, Dynamics of Structures (CRC Press, 2012)
R.E. Moore, Methods and applications of interval analysis. SIAM Stud. Appl. Math. (1979)
N.R. Mahato, S. Chakraverty, Filtering algorithm for real eigenvalue bounds of interval and fuzzy
generalized eigenvalue problems. ASCE-ASME J. Risk Uncertain. Eng. Syst. Part B Mech. Eng.
2(4), 044502 (2016a)
N.R. Mahato, S. Chakraverty, Filtering algorithm for eigenvalue bounds of fuzzy symmetric matri-
ces. Eng. Comput. 33(3), 855–875 (2016b)
Z. Qiu, C.M. Peter, F. Andreas, An approximate method for the standard interval eigenvalue problem
of real non-symmetric interval matrices. Int. J. Numer. Methods Biomed. Eng. 17(4), 239–251
(2001)
Part II
Artificial Neural Network
Chapter 10
Artificial Neural Network Terminologies

10.1 Artificial Neural Network

Neural network (NN) is an information processing paradigm which is inspired by the


human nervous systems. It is known as artificial neural network (ANN) because the
processing is similar to the human brain. An ANN is composed of large number of
highly interconnected processing elements called the neurons which works in union
to solve different problems. ANN is used in various application problems, such as
pattern recognition, data classification, speech recognition, image processing, and
system identification through different learning procedures. ANNs are a type of
artificial intelligence that attempts to imitate the way a human brain works. Artificial
neural network is an information processing system in which the neurons transfer the
information. The neurons are connected with each other by connection links known
as weights. These weights when multiplied with the input give the net input for
any typical neural network. The output of the net is obtained by applying activation
functions to the net input.
An artificial network is characterized by
1. Architecture (connection between neurons),
2. Training or learning (determining weights on the connections), and
3. Activation functions.
Figure 10.1 shows a simple artificial neural network with three input neurons (X1 ,
X2 , X3 ) and one output neuron (Y). The weights on the connections from X1 , X2 ,
and X3 to neuron Y are given by w1 , w2, and w3 . The activations (output signals) of
these neurons are x1 , x2 , and x3 , respectively (Fausett 1994). The net input, yin , to
neuron Y is the sum of the weighted signals from neurons X1 , X2 , and X3 , i.e., yin
= w1 x1 + w2 x2 + w3 x3 . The activation yin of neuron Y is given by some function
of its net input, y = f (yin ).

© Springer Nature Singapore Pte Ltd. 2019 153


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_10
154 10 Artificial Neural Network Terminologies

X1
w1

w2 Y
X2

w3

X3

Input Layer Output Layer

Fig. 10.1 A simple artificial neural network

10.2 Network Architecture

The arrangement of neurons into layers and the connection patterns within and
between layers are generally called as the network architecture. Neural network can
be classified as single layer, multilayer, and competitive network. The single layer
and multilayer networks are examples of feedforward network, in which the signal
flow from the input units to the output units and competitive network is an example
of recurrent network, (Sivanandam et al. 2006) in which there are closed-loop signal
paths from a unit back to itself.

10.2.1 Single Layer Neural Network

A single layer neural network has one layer of connection weights. The input units
are fully connected to output units but are not connected to other input units and the
output units are not connected to other output units. The typical single layer neural
network figure is shown in Fig. 10.2.

10.2.2 Multilayer Neural Network

A multilayer neural network is a network with one or more layers of nodes between
input and output units. The layer between the input and output units is called the
hidden units. Multilayer neural networks are used to solve more complicated prob-
lems that single layer neural network cannot be trained to perform correctly. The
multilayer neural network is shown in Fig. 10.3.
10.2 Network Architecture 155

X1

w1

X2 Y
w2

w3
X3

Output Layer
Input Layer

Fig. 10.2 A single layer neural network

X1 w1 w10
Z1 Y1
w2
w11
w3 w12

w4 w13
X2 Z2
w5 w14 Y2
w6 w15

w7 w8 w16

w17
w9 Z3
X3 Y3
w18

Input Layer Hidden Layer Output Layer

Fig. 10.3 A multilayer neural network

10.2.3 Competitive Layer Neural Network

A competitive layer forms a part of a large number of neural networks. The com-
petitive neural network is similar to a single layer neural network except that there
are connections, usually negative between the output nodes. Because of these con-
nections, the output nodes tend to compete to represent the current input pattern. An
example of the architecture for a competitive layer is shown in Fig. 10.4.
156 10 Artificial Neural Network Terminologies

Fig. 10.4 A competitive layer neural network

10.3 Different Training Process

The method of setting up of the weights value is known as learning (Zurada 1994). The
process of achieving the expected output by modifying the weights in the connections
between network layers is called training. In general, there are two types of training,
supervised and unsupervised trainings.

10.3.1 Supervised Training

Supervised training means training with the help of a teacher. The process of pro-
viding the network with a series of sample inputs and then comparing the output
with the expected responses is supervised training. The training continues until the
network is able to provide the expected response.

10.3.2 Unsupervised Training

Unsupervised training means training without the help of a teacher. In a neural net, if
the target output is not known for training the input vectors, then the training method
adopted is called as unsupervised training. The net may modify the weight so that the
most similar input vector is assigned to the same output unit. Unsupervised training
is more complex and difficult to implement.
10.4 Activation Function 157

10.4 Activation Function

Let the weighted sum of input into a neuron is denoted by yin . The activation or
 neuron y is then given by applying the activation function f to yin as
output of the
y = f yin . Figure 10.5 shows some activation functions that are generally used.
Some common activation functions are defined below.

f (x) f (x)

Identity x x
Binary step

f (x) f (x)

Bipolar step x
Binary sigmoid x

f (x)

Binary sigmoid x

Fig. 10.5 Some common activation functions


158 10 Artificial Neural Network Terminologies

10.4.1 Some Common Activation Function

(i) Identity function:  


If f is an identity function, y = f yin = yin , the activation (output) of the
neuron is exactly the same as the weighted sum of the input into the neuron.
(ii) Binary step function with threshold:
The function is given by

1 if yin ≥ θ,
y = f (yin ) =
0 if yin < θ.

The threshold value is specified by θ . The output has binary values (0 or 1)


only. Mostly, binary step function is used in single layer neural network for
calculating output from the net input. The binary step function is also called as
threshold function.
(iii) Bipolar step function with threshold:
The function is given by

1 if yin ≥ θ,
y = f (yin ) =
−1 if yin < θ.

The threshold value is specified by θ . The output has bipolar values (1 or −1)
only.
(iv) Binary Sigmoid function:
Sigmoid functions are usually s-shaped curves. These functions are used in
multilayer neural network. The binary sigmoid function is also called logistic
function. The binary sigmoid function is given as

1
y = f (yin ) = ,
1+ e−σ (yin −θ)

where σ is a positive parameter. This function switches from 0 to 1 in the


vicinity of θ as the argument goes from −∞ to ∞. The binary sigmoid function
is smooth. It has a derivative which is also smooth. Its derivative is given by

f  (yin ) = σ f (yin )[1 − f (yin )].

(v) Bipolar sigmoid function:


This function is related to the hyperbolic tangent function. The bipolar sigmoid
function is given as

1 − e−σ (yin −θ)


y = f (yin ) = ,
1 + e−σ (yin −θ)
10.4 Activation Function 159

where σ is a positive parameter. This function switches from −1 to 1 in the


vicinity of θ as the argument goes from −∞ to ∞. The bipolar sigmoid
function is also smooth with a smooth derivative given by
σ
f  (yin ) = [1 + f (yin )][1 − f (yin )].
2

10.4.2 Weights

A neural network consists of a large number of processing elements called neurons.


These neurons are interconnected to each other by directed communication links
known as the weights. Weight is an information used by the neural net to transfer
from one neuron to the other.

10.4.3 Bias

A bias acts exactly as a weight on a connection from a unit whose activation is


always 1. Increasing the bias increases the net input to the unit. The bias improves
the performance of the neural network. Similar to initialization of weights, bias
should also be initialized either to 0 or to any specified value based on the neural net.
If bias is present then net input is calculated as

Net = b + xi wi .
i

Hence, if bias is included, then the activation function is obtained as



1 if Net ≥ 0,
f(Net) =
−1 if Net < 0.

Figure 10.6 shows a simple neural net with a bias.

10.4.4 Threshold

The threshold θ is a factor which is used in calculating the activations of the given
net. Based on the value of threshold, the output may be calculated, i.e., the activation
function is based on the value of θ . If thresholds are included then the activation
function is obtained as
160 10 Artificial Neural Network Terminologies

1 b

Y
w2
X1
w3

X2

Input Layer Output Layer

Fig. 10.6 A simple net with bias


1 if Net ≥ θ,
f(Net) =
−1 if Net < θ,

where net input is calculated as Net = xi wi .
i

10.5 Computing Net Input Using Matrix Multiplication


Method

If the weights are given as W = (wij ) in a matrix form, the net input to output unit
Yj is given as the dot product of the input vectors x = (x1 , … xi … xn ) and wj (jth
column of the weight vector matrix). The net input to unit Yj is given by

yin j = xi · w j ,

n
yin j = xi wi j ,
i=1

n
yin j = b j + xi wi j if bias is included.
i=1

Hence, net input can be calculated using matrix multiplication method


(Figure 10.7).
10.6 Matlab Programs 161

bj

X1 Yj
w1j

wij

Xi
wnj

Xn

Output Layer
Input Layer

Fig. 10.7 Neuron with a bias

10.6 Matlab Programs

10.6.1 Write a Matlab Program to Generate the Following


Activation Functions That Are Used in Neural
Networks: (a) Identity Function, (b) Binary Step
Function with Threshold Value 1 and 0, (c) Binary
Sigmoid Function, and (d) Bipolar Sigmoid Function

Program:
162 10 Artificial Neural Network Terminologies

% Activation Functions
clear all
clc
x1=rand(1,50);
x2=-rand(1,50);
% Identity Function
x=[x1 x2];
y=x;
x=sort(x,'ascend');
figure
plot(x,y,'*')
title('Identity Function');

% Binary Step Function


t=input('enter the value of theta: ');
l=length(x);
for i=1:l
if x(i)>=t
z(i)=1;
else
z(i)=0;
end
end
figure
plot(x,z,'o');
title('Binary Step Function');

% Sigmoid Function
m=50*x;
for i=1:l
f1(i)=1/(1+exp(-m(i)));
end
for i=1:l
f2(i)=(2/(1+exp(-m(i))))-1;
end
figure
plot(x,f1)
title('Binary Sigmoid Function');
figure
plot(x,f2)
title ('Bipolar Sigmoid Function');
10.6 Matlab Programs 163

Output:
The output response is given as

Identity Function
1

0.5
Y=f(x)

-0.5

-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
X

Identity Function

Binary Sigmoid Function


1

0.8

0.6
Y=f(x)

0.4

0.2

0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
X

Binary Sigmoid Function

Bipolar Sigmoid Function


1

0.5
Y=f(x)

-0.5

-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
X
164 10 Artificial Neural Network Terminologies

Bipolar Sigmoid Function

Binary Step Function with threshold 0


1

0.8

0.6
Y=f(x)

0.4

0.2

0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
X

Binary Step Function with Threshold 0

Binary Step Function with threshold 1


1

0.5
Y=f(x)

-0.5

-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
X

Binary Step Function with Threshold 1

10.6.2 Write a Program in Matlab if the Net Input


to an Output Neuron Is 0.38, Calculate Its Output
When the Activation Function Is (a) Binary Sigmoid
Function and (b) Bipolar Sigmoid Function
10.6 Matlab Programs 165

Program:

% Binary Sigmoid and Bipolar Sigmoid


clear all
clc
n=input('enter the value of net: ');
% Binary Sigmoid
disp('the value of activation function in case of Binary Sigmoid is ');
f1=1/(1+exp(-n))
% Bipolar Sigmoid
disp('the value of activation function in case of Bipolar Sigmoid is ');
f2=(2/(1+exp(-n)))-1

Output:
Enter the value of net: 0.38
The value of activation function in case of Binary Sigmoid is
f1 = 0.5939
The value of activation function in case of Bipolar Sigmoid is
f2 = 0.1877

References

L. Fausett, Fundamentals of Neural Networks—Architectures, Algorithms, and Applications (Pren-


tice Hall, 1994)
J. Macek Zurada, Introduction to Artificial Neural Systems (Jaico Publishing House, 1994)
S.N. Sivanandam, S. Sumathi, S.N. Deepa, Introduction to Neural Networks using Matlab 6.0
(McGraw Hill Education (India) Private Ltd., 2006)
Chapter 11
McCulloch–Pitts Neural Network Model

11.1 McCulloch–Pitts Neural Network Model

The McCulloch–Pitt neural network is considered to be the first neural network. The
neurons are connected by directed weighted paths Nakamoto (2017). McCulloch–Pitt
neuron (Sivanandam 2006) allows binary activation (1 ON or 0 OFF), i.e., it either
fires with an activation 1 or does not fire with an activation of 0. If w > 0, then
the connected path is said to be excitatory else it is known as inhibitory. Excitatory
connections have positive weights and inhibitory connections have negative weights.
Each neuron has a fixed threshold for firing. That is, if the net input to the neuron is
greater than the threshold, it fires.

11.2 McCulloch–Pitts Neuron Architecture

The architecture of the McCulloch–Pitts neuron is shown in Fig. 11.1.


“Y” is the McCulloch–Pitts neuron, it can receive signal from any number of
other neurons Laurene (1994). The connection weights from X1 … Xn are excitatory,
denoted by “w” and the connection weights from Xn+1 … Xn+m are inhibitory denoted
by “−p”. The McCulloch–Pitts neuron Y has activation function as

  1 if yin ≥ θ
f yin = ,
0 if yin < θ

where θ is the threshold and yin is the total net input signal received by neuron Y.
The inhibition should be absolute. Hence, the threshold satisfies θ > nw − p.
The output neuron will fire if it receives k or more excitatory inputs with no
inhibitory inputs, where kw ≥ θ > (k − 1) w.

© Springer Nature Singapore Pte Ltd. 2019 167


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_11
168 11 McCulloch–Pitts Neural Network Model

Fig. 11.1 Architecture of


McCulloch–Pitts neuron
X1
w

Xn w Y

-p

Xn+1
-p

Xn+m

11.3 Matlab Programs for McCulloch–Pitts Neuron Model

11.3.1 Write a Matlab Program to Generate the Output


of Logic AND Function by McCulloch–Pitts Neuron
Model. The Threshold on Unit Is 2

X1
1
Y

1
X2
11.3 Matlab Programs for McCulloch–Pitts Neuron Model 169

Program:

% McCulloch Pitt Neuron Method


% AND Gate

clear all
clc
x1=[1 1 0 0];
x2=[1 0 1 0];
w1=input('enter the value of weight w1: ');
w2=input('enter the value of weight w2: ');
t=input('enter the value of threshold value: ');
for i=1:4
n=(x1(i)*w1)+(x2(i)*w2);
if(n>=t)
Y(i)=1;
else
Y(i)=0;
end
end
disp ( ' x1 x2 Y ')
[x1' x2' Y']
Output:
enter the value of weight w1: 1
enter the value of weight w2: 1
enter the value of threshold value: 2
X1 X2 Y
1 1 1
1 0 0
0 1 0
0 0 0

11.3.2 Write a Matlab Program to Generate Output for OR


Function Using McCulloch–Pitts Neurons
with Threshold Value 1
170 11 McCulloch–Pitts Neural Network Model

Program:

% McCulloch Pitt Neuron Method


% OR Gate

clear all
clc
x1=[1 1 0 0];
x2=[1 0 1 0];
w1=input('enter the value of weight w1: ');
w2=input('enter the value of weight w2: ');
t=input('enter the value of threshold value: ');
for i=1:4
n=(x1(i)*w1)+(x2(i)*w2);
if(n>=t)
Y(i)=1;
else
Y(i)=0;
end
end
[x1' x2' Y']
Output:
enter the value of weight w1: 1
enter the value of weight w2: 1
enter the value of threshold value: 1
X1 X2 Y
1 1 1
1 0 1
0 1 1
0 0 0

11.3.3 Write a Matlab Program to Generate Output for XOR


Function Using McCulloch–Pitts Neurons
with Threshold Value 1
11.3 Matlab Programs for McCulloch–Pitts Neuron Model 171

Program:

% McCulloch Pitt Neuron Method


% XOR Gate

clear all
clc
x1=[1 1 0 0];
x2=[1 0 1 0];
y1=input('enter the value of weight y1: ');
y2=input('enter the value of weight y2: ');
v1=input('enter the value of weight v1: ');
v2=input('enter the value of weight v2: ');
w1=input('enter the value of weight w1: ');
w2=input('enter the value of weight w2: ');
t=input('enter the value of threshold value: ');
for i=1:4
n=(x1(i)*y1)+(x2(i)*y2);
if(n>=t)
z1(i)=1;
else
z1(i)=0;
end
end
for i=1:4
n=(x1(i)*v1)+(x2(i)*v2);
if(n>=t)
z2(i)=1;
else
z2(i)=0;
end
end
for i=1:4
n=(z1(i)*w1)+(z2(i)*w2);
if(n>=t)
Y(i)=1;
else
Y(i)=0;
end
end
[x1' x2' Y']
Output:
enter the value of weight y1: 1
enter the value of weight y2: −1
enter the value of weight v1: −1
enter the value of weight v2: 1
172 11 McCulloch–Pitts Neural Network Model

enter the value of weight w1: 1


enter the value of weight w2: 1
enter the value of threshold value: 1
X1 X2 Y
1 1 0
1 0 1
0 1 1
0 0 0

11.3.4 Write a Matlab Program to Generate Output


for ANDNOT Function Using McCulloch–Pitts
Neurons

Program:

% McCulloch Pitt Neuron Method


% AND NOT Gate

clear all
clc
x1=[1 1 0 0];
x2=[1 0 1 0];
w1=input('enter the value of weight w1: ');
w2=input('enter the value of weight w2: ');
t=input('enter the value of threshold value: ');
for i=1:4
n=(x1(i)*w1)+(x2(i)*w2);
if(n>=t)
Y(i)=1;
else
Y(i)=0;
end
end
[x1' x2' Y']
Output:
enter the value of weight w1: 1
enter the value of weight w2: −1
References 173

enter the value of threshold value: 1


X1 X2 Y
1 1 0
1 0 1
0 1 0
0 0 0

References

F. Laurene, Fundamentals of Neural Networks—Architectures, Algorithms, and Applications (Pren-


tice Hall, 1994)
P. Nakamoto, Neural Networks and Deep Learning (Create Space Indepedent Publishing Platform,
2017)
S.N. Sivanandam, S. Sumathi, S.N. Deepa, Introduction to Neural Networks Using Matlab 6.0
(McGraw Hill Education (India) Private Ltd., 2006)
Chapter 12
Hebbian Learning Rule

12.1 Hebbian Net Architecture

Hebbian learning rule is one of the earliest and the simplest learning rules for the
neural networks Laurene (1994). It was proposed by Donald Hebb. Hebb proposed
that if two interconnected neurons are both “on” at the same time, then the weight
between them should be increased. Hebbian network is a single layer neural network
which consists of one input layer with many input units and one output layer with one
output unit. This architecture is usually used for pattern classification (Bosse et al.
2010), (Brito and Gerstner 2016) and Born et al. (2017). The bias which increases
the net input has value 1. The architecture of Hebbian network is shown in Fig. 12.1.

Fig. 12.1 Architecture of a


Hebbian network 1

X1
w1
Y

wi

Xi

wn

Xn

Input Layer Output Layer

© Springer Nature Singapore Pte Ltd. 2019 175


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_12
176 12 Hebbian Learning Rule

12.2 Hebbian Learning Rule Algorithm

The step-by-step algorithm of Hebbian learning rule is as follows (Sivanandam et al.


2006):
Step 1: Initialize all weights and bias to zero, i.e., wi = 0 for i = 1 to n, b = 0.
Here, n is the number of input neurons.
Step 2: For each input training vector and target output pair, S : t, do steps 2–5.
Step 3: Set activation for input units: xi = Si , i = 1, …, n.
Step 4: Set activation for output unit: y = t.
Step 5: Adjust the weights and bias:

wi (new) = wi (old) + xi y for i = 1, . . . , n,


b(new) = b(old) + y.

If the bias is considered to be an input signal that is always 1, the weight change
can be written as

w(new) = w(old) + w, where w = xy.

12.3 Matlab Programs Using Hebbian Learning Rule

12.3.1 Write a Matlab Program to Train XOR Function


Using Hebbian Learning with Bipolar Input
and Targets

Program:

% Hebbian Algorithm
% XOR Gate
clear all
clc
x1=[1 1 -1 -1];
x2=[1 -1 1 -1];
b=[1 1 1 1];
y=[-1 1 1 -1];
w1=0;
w2=0;
h=0;
for i=1:4
12.3 Matlab Programs Using Hebbian Learning Rule 177

d1(i)=x1(i)*y(i);
d2(i)=x2(i)*y(i);
db(i)=b(i)*y(i);
w1_n(i)=w1+d1(i);
w2_n(i)=w2+d2(i);
b_n(i)=h+db(i);
w1=w1_n(i);
w2=w2_n(i);
h=b_n(i);
end
disp(' Input Target Weight Change Weights');
disp(' x1 x2 b Y dw1 dw2 db w1 w2 B');
H=[x1' x2' b' y' d1' d2' db' w1_n' w2_n' b_n'];
disp(H)
Output:

Inputs Target Weight Change Weights

x1 x2 b Y dw1 dw2 db w1 w2 B

1 1 1 -1 -1 -1 -1 -1 -1 -1

1 -1 1 1 1 -1 1 0 -2 0

-1 1 1 1 -1 1 1 -1 -1 1

-1 -1 1 -1 1 1 -1 0 0 0

12.3.2 (a) Write a Matlab Program Using Hebbian Learning


Rule to Find the Weights Required to Perform
the Following Classifications. Vectors (1 1 1 1)
and (−1 1 −1 −1) Are Members of Class (with Target
Value 1); Vectors (1 1 1 −1) and (1 −1 −1 1) Are Not
Members of Class (with Target Value −1)
178 12 Hebbian Learning Rule

Program:

% Hebbian Algorithm
clear all
clc
% a part
x1=[1 -1 1 1];
x2=[1 1 1 -1];
x3=[1 -1 1 -1];
x4=[1 -1 -1 1];
b=[1 1 1 1];
y=[1 1 -1 -1];
w1=0;
w2=0;
w3=0;
w4=0;
h=0;
for i=1:4
d1(i)=x1(i)*y(i);
d2(i)=x2(i)*y(i);
d3(i)=x3(i)*y(i);
d4(i)=x4(i)*y(i);
db(i)=b(i)*y(i);
w1_n(i)=w1+d1(i);
w2_n(i)=w2+d2(i);
w3_n(i)=w3+d3(i);
w4_n(i)=w4+d4(i);
b_n(i)=h+db(i);
w1=w1_n(i);
w2=w2_n(i);
w3=w3_n(i);
w4=w4_n(i);
h=b_n(i);
end
disp(' Input Target Weight Change Weights');
disp(' x1 x2 x3 x4 b Y dw1 dw2 dw3 dw4 db
w1 w2 w3 w4 B');
H=[x1' x2' x3' x4' b' y' d1' d2' d3' d4' db' w1_n' w2_n' w3_n' w4_n'
b_n'];
disp(H)
12.3 Matlab Programs Using Hebbian Learning Rule 179

Output:
Inputs Target Weight Change
x1 x2 x3 x4 b Y dw1 dw2 dw3 dw4 db
1 1 1 1 1 1 1 1 1 1 1
-1 1 -1 -1 1 1 -1 1 -1 -1 1
1 1 1 -1 1 -1 -1 -1 -1 1 -1
1 -1 -1 1 1 -1 -1 1 1 -1 -1

Weights
w1 w2 w3 w4 B
1 1 1 1 1
0 2 0 0 2
-1 1 -1 1 1
-2 2 0 0 0

12.3.3 (b) Using Each of the Training x Vectors as Input, Test


the Response of the Net

Program:

% b part

t=input('enter the value of theta: ');


for i=1:4

yin(i)=(x1(i)*w1_n(i))+(x2(i)*w2_n(i))+(x3(i)*w3_n(i))+(x4(i)*w4_
n(i))+b_n(i);
if yin(i)>=t
Y(i)=1;
else
Y(i)=-1;
end
end
y
Y
if y==Y
disp('correct');
else
disp('not correct');
end
180 12 Hebbian Learning Rule

Output:
enter the value of theta: 0
y=

1 1 -1 -1

Y=

1 1 -1 -1
correct

12.4 Matlab Programs for Pattern Classification Using


Hebb Net

12.4.1 Write a Matlab Program for Hebbian Network


to Classify Two-Dimensional Input Patterns in Bipolar
with Their Targets Given Below:

(a)

+ + +
+
+ + +

Program:

% Pattern Classification (I, J)


clear all
clc
n=input('enter the number of nodes: ');
q=input('enter the input vector of first pattern: ');
t=input('enter the input vector of second pattern: ');
x=[q;t];
b=[0;0];
y=[1;-1];
w=zeros([1,n]);
h=0;
12.4 Matlab Programs for Pattern Classification Using Hebb Net 181

Output:

enter the number of nodes: 9


enter the input vector of first pattern: [1 1 1 −1 1 −1 1 1 1]
enter the input vector of second pattern: [1 1 1 −1 1 −1 1 1 −1]

w1 w2 w3 w4 w5 w6 w7 w8 w9 w10

1 1 1 -1 1 -1 1 1 1 1
0 0 0 0 0 0 0 0 2 0
(b)

+ + +
+
+ +

Program:

% Pattern Classification (E, F)


clear all
clc
n=input('enter the number of nodes: ');
q=input('enter the input vector of first pattern: ');
t=input('enter the input vector of second pattern: ');
x=[q;t];
b=[0;0];
y=[1;-1];
w=zeros([1,n]);
h=0;

for i=1:2
db(i)=y(i);
b_n(i)=h+db(i);
h=b_n(i);
for j=1:n
dw(i,j)=x(i,j)*y(i);
w_n(j)=w(j)+dw(i,j);
w(j)=w_n(j);
end
e(i,:)=w;
end
[e b_n']
182 12 Hebbian Learning Rule

Output:

enter the number of nodes: 20


enter the input vector of first pattern: [1 1 1 1 1 −1 −1 −1 1 1 1 1 1 −1 −1 −1 1 1
1 1]
enter the input vector of second pattern: [1 1 1 1 1 −1 −1 −1 1 1 1 1 1 −1 −1 −1 1
−1 −1 −1]

w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16

1 1 1 1 1 -1 -1 -1 1 1 1 1 1 -1 -1 -1

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

w17 w18 w19 w20 b

1 1 1 1 1

0 2 2 2 0

References

F. Laurene, Fundamentals of Neural Networks—Architectures, Algorithms, and Applications (Pren-


tice Hall, 1994)
S.N. Sivanandam, S. Sumathi, S.N. Deepa, Introduction to Neural Networks using Matlab 6.0 (Mc
Graw Hill Education (India) Pvt. Ltd., 2006)
T. Bosse, M. Hoogendoorn, Z.A. Memon, J. Treur, M. Umair, An Adaptive Model for Dynamics
of Desiring and Feeling Based on Hebbian Learning. In: Y. Yao, R. Sun, T. Poggio, J. Liu, N.
Zhong, J. Huang (eds) Brain Informatics. BI 2010. Lecture Notes in Computer Science, 6334.
Springer, Berlin, Heidelberg (2010)
C.S.N. Brito, W. Gerstner, Nonlinear Hebbian Learning as a Unifying Principle in Receptive Field
Formation. PLoS Comput. Biol. 12(9), 1–24 (2016)
J. Born, J.M. Galeazzi, S.M. Stringer, Hebbian learning of hand-centred representations in a hier-
archical neural network model of the primate visual system. PLoS ONE. 12(5), 1–35 (2017)
Chapter 13
Perceptron Learning Rule

13.1 Single Layer Perceptron

A single layer perceptron is a simplest form of neural network. This type of neural
network is used for pattern classifications that are linearly separable. Single layer
perceptron consists of one input layer with one or many input units and one output
layer with one or many output units. The neurons are connected to each other by
weights and bias (Gkanogiannis and Kalamboukis (2009, 2010)).

13.2 Architecture of Single Layer Perceptron

The structure or architecture of single layer perceptron is shown in Fig. 13.1. In


Fig. 13.1, X1 , X2 , …, Xn are the input neurons of the input layer. There exists a
common bias b with a value 1. w1 , w2 , …, wn are the weights connected from input
node to the output node. Y is the output neuron in the output layer (Zurada 1994).

13.3 Algorithm of Single Layer Perceptron

The step-by-step algorithm is given below (Sivanandam 2006):


Step1: Initialize all weights and bias to zero, i.e., wi = 0 for i = 1–n, b = 0. Here,
n is the number of input neurons. Let us take α = (0–1) as the learning rate.
Step2: For each input training vector and target output pair, S : t, do steps 2–5.
Step3: Set activation for input units : xi = Si , i = 1, …, n.

© Springer Nature Singapore Pte Ltd. 2019 183


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_13
184 13 Perceptron Learning Rule

Fig. 13.1 Single layer


perceptron
1

b
X1
w1

Y
wi

Xi
wn

Xn

Input Layer Output Layer

n
Step 4: Compute the output unit as yin = b + i=1 xi wi .
The activation function is used as

  ⎨ 1, if yin > θ
Y = f yin = 0, if −θ ≤ yin ≤ θ .

−1 if yin < θ

Step5: The weights and bias are updated if the target is not equal to the output
response.
If t = y and the value of xi = 0
then wi (new) = wi (old) + αtxi for i = 1, …, n

b(new) = b(old) + αt

else wi (new) = wi (old)

b(new) = b(old)

The stopping conditions may be the change in weights.


13.4 Matlab Programs Using Perceptron Learning Rule 185

13.4 Matlab Programs Using Perceptron Learning Rule

13.4.1 Write a Matlab Program for and Function


with Bipolar Inputs and Targets Using Perceptron
Learning Algorithm

Program:

% Perceptron 1

clear all
clc
x1=[1 -1 1 -1];
x2=[1 1 -1 -1];
t=[1 -1 -1 -1];
v=[1 1 1 1];
th=input('enter the value of theta: ');
a=input('enter the value of alpha: ');
w1=0;
w2=0;
b=0;
dw1=a.*x1.*t;
dw2=a.*x2.*t;
db=a.*t;
for i=1:4
yin=w1*x1(i)+w2*x2(i)+b;
if yin>th
y=1;
elseif -th<=yin&&yin<=th
y=0;
else
y=-1;
end
if y~=t(i)
w1=w1+dw1(i);
w2=w2+dw2(i);
b=b+db(i);
end
w1_n(i)=w1;
w2_n(i)=w2;
b_n(i)=b;
end
186 13 Perceptron Learning Rule

disp(' Input Target Weight Change Weights');


disp(' x1 x2 b Y dw1 dw2 db w1 w2 B');
H=[x1' x2' v' t' dw1' dw2' db' w1_n' w2_n' b_n'];
disp(H)
Output:
enter the value of theta: 0
enter the value of alpha: 1

Input Target Weight Change Weights

x1 x2 b Y dw1 dw2 db w1 w2 B
1 1 1 1 1 1 1 1 1 1
–1 1 1 –1 1 –1 –1 2 0 0
1 –1 1 –1 –1 1 –1 1 1 –1
–1 –1 1 –1 1 1 –1 1 1 –1

13.4.2 Write a Matlab Program for AND Function


with Binary Inputs and Bipolar Targets Without Bias
up to 2 Epochs Using Perceptron Learning Algorithm

(a) With (0, 0) and without bias


Program:

% Perceptron 2

clear all
clc
x1=[1 1 0 0];
x2=[1 0 1 0];
t=[1 -1 -1 -1];
th=input('enter the value of theta: ');
a=input('enter the value of alpha: ');
dw1=a.*x1.*t;
dw2=a.*x2.*t;
for l=4:-1:3
w1=0;
w2=0;
for j=1:2
13.4 Matlab Programs Using Perceptron Learning Rule 187

for i=1:l
yin=x1(i)*w1+x2(i)*w2;
if yin>th
y=1;
elseif -th<=yin&&yin<=th
y=0;
else
y=-1;
end
if y~=t(i)
w1=w1+dw1(i);
w2=w2+dw2(i);
end
w1_n(i)=w1;
w2_n(i)=w2;
end
end
disp(' Weights');
disp(' w1 w2');
H=[w1_n' w2_n'];
disp(H)
clear w1_n;
clear w2_n;
end
Output:
enter the value of theta: 0
enter the value of alpha: 1

Input Target Weights

x1 x2 Y w1 w2
1 1 1 1 1

0 1 –1 0 1

1 0 –1 0 0

0 0 –1 0 0
188 13 Perceptron Learning Rule

(b) Without bias and (0, 0)

Input Target Weights

x1 x2 Y w1 w2
1 1 1 1 1

0 1 –1 0 1

1 0 –1 0 0

References

J. Macek Zurada, Introduction to Artificial Neural Systems (Jaico Publishing House, 1994)
S.N. Sivanandam, S. Sumathi, S.N. Deepa, Introduction to Neural Networks using Matlab 6.0
(McGraw Hill Education (India) Private Ltd., 2006)
A. Gkanogiannis, T. Kalamboukis, A modified and fast Perceptron learning rule and its use for Tag
Recommendations in Social Bookmarking Systems. ECML PKDD Discovery Challenge 2009
(DC09). 497(71), 1–13 (2009)
A. Gkanogiannis, T. Kalamboukis, A Perceptron-Like Linear Supervised Algorithm for Text Clas-
sification. In: L. Cao, Y. Feng, J. Zhong (eds) Advanced Data Mining and Applications. ADMA
2010. Lect. Notes Comp. Sci. 6440. Springer, Berlin, Heidelberg (2010)
Chapter 14
Delta Learning Rule
and Backpropagation Rule
for Multilayer Perceptron

14.1 Feedforward Networks

In a network, if the output values cannot be traced back to the input values and if
for every input vector, an output vector is calculated, then there is a forward flow of
information and no feedback between the layers. Such type of network is known as
feedforward networks (Laurene 1994), Zurada(1994).

14.2 Delta Learning Rule or Backpropagation Rule

Backpropagation is one type of feedforward network. Backpropagation is mainly


used to train multilayer neural network. Training with backpropagation comprises
feedforward of the input training pattern, calculation and backpropagation of the
associated error, and adjustment of weights and bias. Extend gradient descent based
delta learning rule is commonly known as backpropagation rule (Chakraverty et al.
2003), (Chakraverty et al. 2006), Chakraverty (2007).

14.3 Training Algorithm with Unipolar Sigmoid Function

The training depends upon which type of activation function is used (Chakraverty
and Sahoo (2014, 2015)). Here, algorithm is given for unipolar sigmoid function.
The step-by-step algorithm is given below Shivanandam (2006):
Step 1: Initialize weights to some small random values. Let us take η as the learn-
ing rate.
Step 2: For each training pair do steps 3–10.

© Springer Nature Singapore Pte Ltd. 2019 189


S. Chakraverty et al., Concepts of Soft Computing,
https://doi.org/10.1007/978-981-13-7430-2_14
190 14 Delta Learning Rule and Backpropagation …

Step 3: Here, each input unit is considered as xi for i = 1, …, n which transfers


its data to the hidden layer.
Step 4: Each hidden unit is considered here as zj for j = 1, …, p which are the
weighted sum of the input vector,


n
zin = θi + xi vij ,
i=1

θi is the bias from input to hidden unit and vij are the weights from input
to hidden units.
The activation function defined as f(x) = 1+exp(−x)
1
and its derivative is
defined as

f (x) = f(x)[1 − f(x)].

Now applying the activation function, we get zj = f(zin ).


Step 5: The output unit is taken as yk for k = 1, …, m which are the weighted sum
of hidden input vector,


p
yin = θj + zj wjk ,
j=1

θj is the bias from hidden to output unit and wjk are the weights from hidden
to output units. Applying the activation function to calculate output unit
 
yk = f yin .

Step 6: Error value is computed as

1 2
E= tk − y k .
2
Step 7: Error signal between the output and hidden layer δk is given as
  
δk = tk − yk 1 − yk yk for k = 1, . . . , m.

Step 8: Error signal between the hidden and input layer δj is given as
14.3 Training Algorithm with Unipolar Sigmoid Function 191

 
m
δj = zj 1 − zj δk wjk for j = 1, . . . , p.
k=1

Step 9: The weights and bias of the output layer are updated as

wjk (new) = wjk (old) + ηδk yk ,

θk (new) = θk (old) + ηδk .

Step 10: The weights and bias of the hidden layer are updated as

vij (new) = vij (old) + ηδj zj ,

θj (new) = θj (old) + ηδj .

Step 11: The stopping conditions is the minimization of errors.

14.4 Training Algorithm with Bipolar Sigmoid Function

Here, algorithm is given for bipolar sigmoid function (Chakraverty et al. 2010). The
step-by-step algorithm is given below:
Step 1: Initialize weights to some small random values. Let us take η as the learn-
ing rate.
Step 2: For each training pair do steps 3–10.
Step 3: Here, each input unit is considered as xi for i = 1, …, n which transfers
its data to the hidden layer.
Step 4: Each hidden unit is considered here as zj for j = 1, …, p which are the
weighted sum of the input vector,


n
zin = θi + xi vij ,
i=1

θi is the bias from input to hidden unit and vij are the weights from input
to hidden units.
The activation function is defined as f(x) = 1+exp(−x)
2
−1 and its derivative
is defined as

1
f (x) = [1 + f(x)][1 − f(x)].
2
192 14 Delta Learning Rule and Backpropagation …

Now applying the activation function, we get zj = f(zin ).


Step 5: The output unit is taken as yk for k = 1, …, m which are the weighted sum
of hidden input vector,


p
yin = θj + zj wjk ,
j=1

θj is the bias from hidden to output unit and wjk are the weights from hidden
to output units. Applying the activation function to calculate output unit
 
yk = f yin .

Step 6: Error value is computed as

1 2
E= tk − y k .
2
Step 7: Error signal between the output and hidden layer δk is given as

1  
δk = tk − yk 1 − y2k for k = 1, . . . , m.
2
Step 8: Error signal between the hidden and input layer δj is given as

1  m
δj = 1 − z2j δk wjk for j = 1, . . . , p.
2 k=1

Step 9: The weights and bias of the output layer are updated as

wjk (new) = wjk (old) + ηδk yk ,

θk (new) = θk (old) + ηδk .

Step 10: The weights and bias of the hidden layer are updated as

vij (new) = vij (old) + ηδj zj ,

θj (new) = θj (old) + ηδj .

Step 11: The stopping conditions is the minimization of errors.


14.5 Matlab Programs for Multilayer Neural Network … 193

14.5 Matlab Programs for Multilayer Neural Network


Using Backpropagation Algorithm

14.5.1 Write a Matlab Program to Find the New Weights


for Input Patterns [0.6 0.8 0] and Target Output is 0.9.
Use Learning Rate Alpha = 0.3 and Use Binary
Sigmoid Activation Function

-1
y
2 1
-1
1
Z1
Z2 Z3
0 3
-1
1
2 1 2
0 2 1
1
X1 X2
X3

Program:

% Multilayer Perceptron

clear all
clc
% Step-1: Initialization
x=[0.6 0.8 0];
t=0.9;
a=0.3;
v=[2 1 0;1 2 2;0 3 1];
vo=[0 0 -1];
w=[-1 1 2];
wo=-1;
194 14 Delta Learning Rule and Backpropagation …

% Feed Forward
% Step-2
for j=1:3
zin(j)=vo(j)+dot(v(:,j),x);
z(j)=1/(1+exp(-zin(j)));
end
% Step-3
yin=wo+dot(z,w);
y=1/(1+exp(-yin));
% Step-4
E=0.5*((t-y)^2);
% Back Propagation
% Step-5
delk=(t-y)*y*(1-y);
% Step-6
for j=1:3
delin(j)=delk*w(j);
del(j)=delin(j)*z(j)*(1-z(j));
end
% Step-7
delwok=a*delk;
wo=wo+delwok;
for j=1:3
delwjk(j)=a*delk*z(j);
w(j)=w(j)+delwjk(j);
end
% Step-8
for i=1:3
delvo(i)=a*del(j);
vo(i)=vo(i)+delvo(i);
for j=1:3
delv(i,j)=a*del(j)*x(i);
v(i,j)=v(i,j)+delv(i,j);
end
end
w
v
14.5 Matlab Programs for Multilayer Neural Network … 195

Output:

w=

-0.9792 1.0213 2.0153

v=

1.9985 1.0013 0.0065

0.9980 2.0017 2.0087

0 3.0000 1.0000

References

F. Laurene, Fundamentals of Neural Networks—Architectures, Algorithms, and Applications (Pren-


tice Hall, 1994)
J. Macek Zurada, Introduction to Artificial Neural Systems (Jaico Publishing House, 1994)
S. Chakraverty, R.K. Sharma, V.P. Singh, Soft-Computing Approach for Identification of Dynamic
Systems. J. of New Build. Mat. and Const. World. 9(2), 50–56 (2003)
S.N. Sivanandam, S. Sumathi, S.N. Deepa, Introduction to Neural Networks Using Matlab
6.0 (McGraw Hill Education (India) Private Ltd., 2006)
S. Chakraverty, T. Marwala, P. Gupta, Response prediction of structural system subject to earthquake
motions using artificial neural network, Asian. J. Civil. Eng. 7, 301–8 (2006)
S. Chakraverty, Identification of Structural Parameters of Two-Storey Shear Buildings by the Iter-
ative Training of Neural Networks. J. Arch. Sci. Rev. 50 (4), 380–384 (2007)
S. Chakraverty, P. Gupta, S. Sharma, Neural network-based simulation for response identification
of two-storey shear building subject to earthquake motion, Neural. Comput. Appl. 19, 367–75
(2010)
S. Chakraverty, D.M. Sahoo, Interval response data based system identification of multi storey
shear building using interval neural network modeling. Comp. Ass. Meth. in Eng. and Sci. 21(2),
123–140 (2014)
S. Chakraverty, D.M. Sahoo, Fuzzy neural network-based system identification of multi-storey
shear buildings. Neural. Comput. Appl. 27(2), 1–16 (2015)

You might also like