Vectorial use of membership functions
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 ?
0 commentaires
Réponses (1)
Sam Chak
le 11 Avr 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)
0 commentaires
Voir également
Catégories
En savoir plus sur Fuzzy Logic Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
