Vectorial use of membership functions

1 回表示 (過去 30 日間)
dario
dario 2015 年 2 月 25 日
回答済み: Sam Chak 2025 年 4 月 11 日
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 ?

回答 (1 件)

Sam Chak
Sam Chak 2025 年 4 月 11 日
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

カテゴリ

Help Center および File ExchangeFuzzy Logic Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by