# Untitled

unknown
plain_text
a month ago
1.8 kB
2
Indexable
Never
% Zdefiniowanie zbiorów rozmytych A i B
A = [0.3, 1; 0.7, 2; 0.5, 3; 0.8, 4];
B = [0.5, -2; 0.4, -1; 1.0, 0; 0.7, 2; 0.6, 3];

% Zdefiniowanie odwzorowań f
f1 = @(x) 2 * x + 1;
f2 = @(x) (x - 2).^2 + 5;
f3 = @(x, y) x .* y;
f4 = @(x, y) (x - 3) .* y.^2;
f5 = @(x, y) (x - 3).^2 .* y.^2;

% Inicjalizacja subplot
figure;

% Obliczenie odwzorowań i wyświetlenie wyników
for i = 1:5
subplot(2, 3, i);
switch i
case 1
C = [];
for j = 1:size(A, 1)
for k = 1:size(B, 1)
C = [C; f1(A(j, 1)), f1(B(k, 1)), min(A(j, 2), B(k, 2))];
end
end
title('f(x) = 2x + 1');
case 2
C = [];
for j = 1:size(A, 1)
for k = 1:size(B, 1)
C = [C; f2(A(j, 1)), f2(B(k, 1)), min(A(j, 2), B(k, 2))];
end
end
title('f(x) = (x - 2)^2 + 5');
case 3
C = [];
for j = 1:size(A, 1)
for k = 1:size(B, 1)
C = [C; f3(A(j, 1), B(k, 1)), min(A(j, 2), B(k, 2))];
end
end
title('f(x, y) = xy');
case 4
C = [];
for j = 1:size(A, 1)
for k = 1:size(B, 1)
C = [C; f4(A(j, 1), B(k, 1)), min(A(j, 2), B(k, 2))];
end
end
title('f(x, y) = (x - 3)y^2');
case 5
C = [];
for j = 1:size(A, 1)
for k = 1:size(B, 1)
C = [C; f5(A(j, 1), B(k, 1)), min(A(j, 2), B(k, 2))];
end
end
title('f(x, y) = (x - 3)^2 * y^2');
end

scatter3(C(:, 1), C(:, 2), C(:, 3), 'filled');
xlabel('x');
ylabel('y');
zlabel('Membership');
grid on;
end