Lab Mannual for soft computing, Study notes of Economics

Fuzzy Logic and Neural Network Lab mannual

Typology: Study notes

2020/2021

Uploaded on 09/26/2021

himanshu-gupta-17
himanshu-gupta-17 🇮🇳

1 document

1 / 37

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ANNAMALAI UNIVERSITY
FACULTY OF ENGINEERING AND TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
B.E (CSE)
VII - SEMESTER
08CP706 – SOFT COMPUTING TECHNIQUES LAB
Name: …………………………………………………………………........................
Reg. No. :……………….………………………………………………………….........
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Lab Mannual for soft computing and more Study notes Economics in PDF only on Docsity!

ANNAMALAI UNIVERSITY

FACULTY OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

B.E (CSE)

VII - SEMESTER

08CP706 – SOFT COMPUTING TECHNIQUES LAB

Name: …………………………………………………………………........................

Reg. No. : ……………….………………………………………………………….........

ANNAMALAI UNIVERSITY

FACULTY OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BONAFIDE CERTIFICATE

Certified that this is the bonafide record of work done by

Mr./Ms.…............………………………………………..Reg. No.…………………of

VII - Semester B.E(Computer Science & Engineering) in the 08CP706 - Soft

Computing Techniques Lab during the odd semester of the academic year

Staff In-charge Internal Examiner

Place: Annamalainagar External Examiner

Date:

Performing Union, Intersection and Complement Operations

Ex. No: 1 Date:

Aim : To write a Program in MATLAB to perform union, intersection and complement operations of fuzzy set.

Algorithm:

  1. Read the membership values of two fuzzy sets.
  2. Perform union operation by using max( ) function.
  3. Perform intersection operation by using min( ) function.
  4. Perform complement operation by subtracting membership value from 1
  5. Display the result.

Program:

% Enter the membership value of fuzzy set

u = input (‘Enter the membership value of First Fuzzy set’);

v = input (‘Enter the membership value of Second Fuzzy set’);

%performs Union, Intersection and Complement operations

w=max (u, v);

p=min (u, v);

q1=1-u;

q2=1-v;

%Display Output

disp(‘Union of Two Fuzzy sets’);

disp(w);

disp(‘Intersection of Two Fuzzy sets’);

disp(p);

disp(‘Complement of First Fuzzy set’);

disp(q1);

disp(‘Complement of Second Fuzzy set’);

disp(q2);

Sample Input and Output: Enter the membership value of First Fuzzy set [0.3 0.4] Enter the membership value of Second Fuzzy set [0.1 0.7] Union of Two Fuzzy sets 0.3000. 0. Intersection of Two fuzzy sets 0.1000 0.4000. Complement of First Fuzzy set 0.7000 0.6000. Complement of Second Fuzzy set 0.9000 0.3000.

Result:

Thus, the MATLAB program to perform Union, Intersection and Complement operations

of two Fuzzy sets has been executed successfully and the output is verified.

disp(w); disp(‘Intersection of two fuzzy sets ’); disp(p); disp(‘Complement of first fuzzy set ’); disp(q1); disp(‘Complement of second fuzzy set ’); disp(q2); disp(‘De-Morgan’s Law’); disp(‘LHS’); disp(x1); disp(‘RHS’); disp(x2); disp(LHS); disp(y1); disp(‘RHS’); disp(y2);

Sample Input and output:

Enter the membership values of first fuzzy set [0.3 0.4] Enter the membership values of second fuzzy set [0.2 0.5] Union of two fuzzy sets 0.3000. 0. Intersection of two fuzzy sets 0.3000 0.4000. Complement of first fuzzy set 0.7000 0.6000. Complement of second fuzzy set

De –Morgan’s Law LHS 0.7000 0. RHS 0.7000 0. LHS 0.8000 0. RHS 0.8000 0.

Result:

Thus, the MATLAB program for implementation of De-Morgan’s has been executed successfully and the output is verified.

y1=gbellmf (x,[3 5 7]);

subplot(313)

plot(x, [y1]);

Sample Input and Output:

Result:

Thus, the MATLAB program for plotting membership functions has been executed successfully and the output is verified.

Using Fuzzy toolbox to model tips value

Ex. No: 4 Date:

Aim : To use fuzzy toolbox to model tips value that is given after a dinner based on quality (not good, satisfying, good and delightful ) and service (poor, average or good) and the tip value ranges from Rs. 10 to 100.

Procedure:

INPUTS:

Quality : { not good, satisfying, good, delightful }

Service : { poor, average, good }

OUTPUT:

Tips : Tip_value ranging from Rs. 10 to 100

Use Fuzzy Inference System (FIS) Editor and perform the following

  1. Go to command window in Matlab and type fuzzy.
  2. New Fuzzy Logic Designer window will be opened.
  3. Give Input / Output Variable. a. Go to Edit Window and click Add variable b. As per our requirements create two input variables namely quality and service Quality : { not good, satisfying, good, delightful } Service : { poor, average, good } c. Similarly, one output variable as tip value ranges from 10 to 100.
  4. The values for Quality and Service variables are selected for their respective ranges.
  5. Quality: a. Double click the Quality input variable. b. New window will be opened and remove all the Membership Functions. c. Go to Edit and Click Add MFs and select the 4 Parameters for Quality table.

Membership functions for Quality variable

Membership functions for Service variable

Membership functions for Tips variable

Created rules

Implementation of Fuzzy Inference System

Ex. No: 5 Date:

Aim :

To implement a Fuzzy Inference System (FIS) for which the inputs, output and rules are

given as below.

INPUTS: Temperature and Cloud Cover

Temperature: {Freeze, Cool, Warm and Hot} Cloud Cover: {Sunny, Partly Cloud and Overcast}

OUTPUT: Speed

Speed : {Fast and Slow}

RULES:

  1. If cloud cover is Sunny and temperature is warm, then drive Fast Sunny (Cover) and Warm (Temp) -> Fast (Speed)
  2. If cloud cover is cloudy and temperature is cool, then drive Slow Cloudy (Cover) and Cool (Temp) -> Slow (Speed)

Procedure

  1. Go to command window in Matlab and type fuzzy.
  2. Now, new Fuzzy Logic Designer window will be opened.
  3. Input / Output Variable a. Go to Edit Window and click Add variable. b. As per our requirements create two input variables, Temperature and Cloud Cover. c. Create one output variable, Speed.
  4. Temperature: a. Double click the Temperature input variable in Fuzzy Logic Designer window. b. New window will be opened and remove all the Membership Functions. c. Now, Go to Edit and Click Add MFs and select the 4 Parameters for Temperature Class. d. Change the following fields as mentioned data in the given below table.

Inputs : Temperature  Freezing, Cool, Warm and Hot

MF1: Range : [0 110] Name : Freezing Type : trapmf Parameter [0 0 30 50]

MF2:

Range : [0 110] Name : Cool Type : trimf Parameter [30 50 70]

MF3:

Range : [0 110] Name : Warm Type : trimf Parameter [50 70 90]

MF4:

Range : [0 110] Name : Hot Type : trapmf Parameter [70 90 110 110]

  1. Similarly, add the data’s to the Cloud Cover variables and Speed variables.
  2. Cloud Cover:

Inputs : Cloud Cover  Sunny, Partly Cloud and Overcast MF1: Range : [0 100] Name : Sunny Type : trapmf Parameter [0 0 20 40]

MF2:

Range : [0 100] Name : Partly Cloud Type : trimf Parameter [20 50 80]

MF3:

Range : [0 100] Name : Overcast Type : trapmf Parameter [60 80 100]

  1. Speed:

Output : Speed  Slow and Fast MF1: Range : [0 100] Name : Slow Type : trapmf Parameter [0 0 25 75]

MF2:

Range : [0 100] Name : Fast Type : trapmf Parameter [25 75 100 100]

  1. Goto Rules: Edit  Rules
  2. Add the Rules Rule-1 : Sunny (Cover) and Warm (Temp) -> Fast (Speed) Rule-2 : Cloudy (Cover) and Cool (Temp) -> Slow (Speed)
    1. Go to view  Rules
    2. Exit.

Membership functions for speed variable

Created rules

Output

Result:

Thus a Fuzzy Inference System is implemented for temperature, cloud cover and speed using the given rules.