Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
45 views21 pages

Plotting in Matlab and Fuzzy Logic Toolbox - An Introduction

This document provides an introduction to plotting in Matlab and the Fuzzy Logic Toolbox. It discusses various 2D and 3D plotting functions in Matlab like plot, bar, mesh, and surf. It also gives examples of plotting a line graph and mesh plot. Next, it demonstrates how to create and plot membership functions for fuzzy logic systems. Finally, it discusses the Fuzzy Logic Toolbox GUI and how to build a basic fuzzy inference system from scratch to determine tip amounts based on food and service quality.

Uploaded by

Bilal Shahid
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views21 pages

Plotting in Matlab and Fuzzy Logic Toolbox - An Introduction

This document provides an introduction to plotting in Matlab and the Fuzzy Logic Toolbox. It discusses various 2D and 3D plotting functions in Matlab like plot, bar, mesh, and surf. It also gives examples of plotting a line graph and mesh plot. Next, it demonstrates how to create and plot membership functions for fuzzy logic systems. Finally, it discusses the Fuzzy Logic Toolbox GUI and how to build a basic fuzzy inference system from scratch to determine tip amounts based on food and service quality.

Uploaded by

Bilal Shahid
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Plotting in Matlab and

Fuzzy Logic Toolbox


-------An Introduction
PLOT (2-D plotting)
Linear plot.
PLOT(X,Y) plots vector Y versus vector X.
If X or Y is a matrix, then the vector is plotted versus the rows or
columns of the matrix, whichever line up.
If X is a scalar and Y is a vector, length(Y) disconnected points are
plotted.
PLOT(Y) plots the columns of Y versus their index.
If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).
In all other uses of PLOT, the imaginary part is ignored.
Line plot
x = 0 : 0.05 : 5;
y = sin(x .^ 2);
plot(x, y);
Other 2-D plotting
bar
stairs
errorbar
polar
stem
MESH (3-D plotting)
% Mesh Plot of Peaks
z=peaks(25);
mesh(z);
Other 3-D plotting
surf
surfl
contour
quiver
slice
Example




Membership Function of young
Filename: mfyoung.m
function y = mfyoung(x) % member function: young
y = exp(-power(x/20,2));

2
20
|
.
|

\
|

=
x
young
e y




Membership Function of old
Filename: mfold.m
function y = mfold(x) % member function: old
y = exp(-power((x-100)/30,2));

2
30
100
|
.
|

\
|

=
x
old
e y
2
old veryold
y y =
2
young veryyoung
y y =
( )
veryold veryyoung veryold not and veryyoung not
y y y , min
_ _ _ _
=
( )
veryold veryyoung veryold or veryyoung
y y y , max
_ _
=
x = 0:1:100; % people age between 0 and 100.

y=min((1-power(mfyoung(x), 2)),(1-power(mfold(x), 2)));
% not very young and not very old.
plot(x,y)

y=max(power(mfyoung(x), 2), power(mfold(x), 2));
% very young or very old
figure, plot(x,y) % open a new figure window and plot

Fuzzy Logic Toolbox (GUI)
Start the toolbox:
FIS Editor
MF Editor

Rules Editor

Command Line functions
plotfis
plotmf
gensurf
Built-in membership functions

Building a FIS from scratch
The Basic Tipping Problem. Given a
number between 0 and 10 that represents the
quality of service at a restaurant (where 10 is
excellent), and another number between 0 and
10 that represents the quality of the food at that
restaurant (again, 10 is excellent), what should
the tip be?

Building a FIS from scratch (cont.)
1. If the service is poor or the food is rancid, then tip
is cheap.
2. If the service is good, then tip is average.
3. If the service is excellent or the food is delicious,
then tip is generous.
We'll assume that an average tip is 15%, a
generous tip is 25%, and a cheap tip is 5%. It's also
useful to have a vague idea of what the tipping
function should look like.

Decision Surface

http://www.mathworks.com/access/helpdesk/h
elp/pdf_doc/fuzzy/fuzzy_tb.pdf
http://www.mathworks.com/access/helpdesk/h
elp/toolbox/fuzzy/fuzzy.shtml

You might also like