I have a problem in which I have to define a fuzzy membership function with variable x(1) x(2) like below. For these variables I have to generate random number between 1 and 5. x(1)<x(2). What will be code for that?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a problem in which I have to define a fuzzy membership function with variable x(1) x(2) like below. For these variables I have to generate random number between 1 and 5. x(1)<x(2). What will be code for that? a=addmf(a,'input',1,'P','trimf',[0 x(1) x(2)]);
0 comentarios
Respuestas (1)
Sam Chak
el 23 de Sept. de 2024
Set a constraint on
so that
.
fis = sugfis;
%% Random integer generator
n1 = 3;
n2 = 5 - n1;
x1 = randi(n1, 1);
x2 = randi(n2, 1) + x1; % ensures x1 < x2
%% Fuzzy Input 1
fis = addInput(fis, [-1 +5], 'Name', 'x');
fis = addMF(fis, 'x', 'trimf', [0 x1 x2], 'Name', 'P');
%% Plot membership functions for input 1
plotmf(fis, 'input', 1), grid on, title('MFs for x')
0 comentarios
Ver también
Categorías
Más información sobre Fuzzy Logic Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
