Vectorial use of membership functions

1 Ansicht (letzte 30 Tage)
dario
dario am 25 Feb. 2015
Beantwortet: Sam Chak am 11 Apr. 2025
Hello I have a family of membership functions, that is n s-shaped mf with different parameters. Then I have n points and each of them must be tested on a singular MF. I tried:
res = smf([x_1;x_2;..;x_n],[a_1 b_1;a_2 b_2;...; a_n b_n])
of course is not working. Is it possible to implement this problem with a singular instruction or shall I implement a cycle ?

Antworten (1)

Sam Chak
Sam Chak am 11 Apr. 2025
Here is a demo in which six different S-shaped membership functions are generated and evaluated at a target input using a for-loop approach. The results are then tabulated using the array2table() command.
%% settings
x = linspace(-1, 1, 201);
a = -0.5:0.1:0.0; % 1st parameter of smf
b = 0.0:0.1:0.5; % 2nd parameter of smf
y = zeros(numel(a), 2); % initialization
tgt = 0; % target
%% generate plots
hold on
for i = 1:numel(a)
mf = @(x) smf(x, [a(i), b(i)]);
y(i,:) = [mf(tgt), i];
plot(x, mf(x))
plot(tgt, mf(tgt), 'k.')
end
hold off
%% labels
grid on, ylim([-0.5, 1.5])
xlabel('x'), ylabel('Degree of membership')
title('A family of S-shaped membership functions')
T = array2table(y, 'VariableNames', {'mu', 'i'});
fprintf('The degree of membership evaluated at x = %.4f.\n', tgt); disp(T)
The degree of membership evaluated at x = 0.0000. mu i ____ _ 1 1 0.92 2 0.68 3 0.32 4 0.08 5 0 6

Kategorien

Mehr zu Fuzzy Logic Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by