How to design a Fuzzy System for only five data points

2 views (last 30 days)
I'm new to Matlab. I want to make membership function of an array (Normalized Delay) having 5 values in it . x-axis -> Norm Delay, Y-axis-> Membership function from 0 to 1. Anyone can guide me Please how to make rules? What is the fuzzificaton language? How to implement it in Matlab? Thankyou.
  1 Comment
Sam Chak
Sam Chak on 22 Feb 2022
It is perfect okay to ask and learn how to do it in MATLAB.
Can you at least sketch how the membership functions should look like on a piece of paper, then snap a picture and insert the image here by clicking the Image button ?

Sign in to comment.

Answers (1)

Sam Chak
Sam Chak on 22 Apr 2025
Here is a demonstration of employing the Stone–Weierstrass theorem (instead of Taylor series) to design a relatively simple fuzzy system aimed at achieving 100% accuracy in the prediction of the five data points.
%% 5-point Data
x = 1:5;
y = randn(1, 5)
y = 1×5
0.8022 -1.6507 0.4491 -0.5216 0.5675
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
figure
plot(x, y, '-o'), grid on
xlabel('x (input)')
ylabel('y (output)')
title('5-point Data')
%% Sugeno Fuzzy System
fis = sugfis;
% Fuzzy Input 1
fis = addInput(fis, [x(1) x(end)], 'Name', 'X');
fis = addMF(fis, 'X', 'linzmf', [ x(1), x(2)], 'Name', 'x1');
fis = addMF(fis, 'X', 'trimf', [x(1), x(2), x(3)], 'Name', 'x2');
fis = addMF(fis, 'X', 'trimf', [x(2), x(3), x(4)], 'Name', 'x3');
fis = addMF(fis, 'X', 'trimf', [x(3), x(4), x(5)], 'Name', 'x4');
fis = addMF(fis, 'X', 'linsmf', [x(4), x(5) ], 'Name', 'x5');
plotmf(fis, 'input', 1), grid on,
title('Uniformly distributed membership functions of Input x')
% Fuzzy Output
fis = addOutput(fis, [min(y) max(y)], 'Name', 'Y');
fis = addMF(fis, 'Y', 'constant', y(1), 'Name', 'y1');
fis = addMF(fis, 'Y', 'constant', y(2), 'Name', 'y2');
fis = addMF(fis, 'Y', 'constant', y(3), 'Name', 'y3');
fis = addMF(fis, 'Y', 'constant', y(4), 'Name', 'y4');
fis = addMF(fis, 'Y', 'constant', y(5), 'Name', 'y5');
% Fuzzy Rules
rules = [
"X==x1 => Y=y1"
"X==x2 => Y=y2"
"X==x3 => Y=y3"
"X==x4 => Y=y4"
"X==x5 => Y=y5"
];
fis = addRule(fis, rules);
%% Fuzzy model
figure
opt = gensurfOptions('NumGridPoints', 5);
gensurf(fis, opt);
title('Achieving 100% prediction accuracy in Fuzzy Model')

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!