Untitled

 avatar
unknown
plain_text
a year ago
1.3 kB
5
Indexable
% Podane zbiory rozmyte 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];

% Definicja 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 zmiennych C dla każdego odwzorowania f dla zbioru B
C1_B = zeros(size(B, 1), 1);
C2_B = zeros(size(B, 1), 1);
C3_B = zeros(size(B, 1), 1);
C4_B = zeros(size(B, 1), 1);
C5_B = zeros(size(B, 1), 1);

% Wyznaczenie zbioru C dla każdego punktu z B
for i = 1:size(B, 1)
    x = B(i, 1);
    y = B(i, 2);
    C1_B(i) = f1(x);
    C2_B(i) = f2(x);
    C3_B(i) = f3(x, y);
    C4_B(i) = f4(x, y);
    C5_B(i) = f5(x, y);
end

% Wykresy zbiorów C dla zbioru B
subplot(3, 2, 1);
stem(B(:, 1), C1_B);
title('f(x) = 2x + 1');
xlabel('x');
ylabel('Membership');

subplot(3, 2, 2);
stem(B(:, 1), C2_B);
title('f(x) = (x - 2)^2 + 5');
xlabel('x');
ylabel('Membership');

subplot(3, 2, 3);
stem(B(:, 1), C3_B);
title('f(x, y) = xy');
xlabel('x');
ylabel('Membership');

subplot(3, 2, 4);
stem(B(:, 1), C4_B);
title('f(x, y) = (x - 3)y^2');
xlabel('x');
ylabel('Membership');

subplot(3, 2, 5);
stem(B(:, 1), C5_B);
title('f(x, y) = (x - 3)^2 * y^2');
xlabel('x');
ylabel('Membership');
Editor is loading...
Leave a Comment