필터 지우기
필터 지우기

Need help in transpose of triangular fuzzy matrix

조회 수: 7 (최근 30일)
Ashutosh
Ashutosh 2023년 3월 21일
답변: Balavignesh 2024년 7월 4일 9:40
Eq=[1 1 1];
Wa=[1 2 3];
Nb=[2 3 4];
Pb=[3 4 5];
Gd=[4 5 6];
Fg=[5 6 7];
Vg=[6 7 8];
Ab=[7 8 9];
Pf=[9 9 9];
DM=[Vg Ab Ab Gd Vg;
Pf Wa Wa Vg Vg;
Ab Wa Wa Ab Pf;
Vg Nb Pb Fg Ab;
Vg Wa Pb Vg Vg;
Gd Pb Nb Wa Vg;
Ab Gd Nb Ab Ab;
Ab Vg Ab Gd Pb;]
DM = 8×15
6 7 8 7 8 9 7 8 9 4 5 6 6 7 8 9 9 9 1 2 3 1 2 3 6 7 8 6 7 8 7 8 9 1 2 3 1 2 3 7 8 9 9 9 9 6 7 8 2 3 4 3 4 5 5 6 7 7 8 9 6 7 8 1 2 3 3 4 5 6 7 8 6 7 8 4 5 6 3 4 5 2 3 4 1 2 3 6 7 8 7 8 9 4 5 6 2 3 4 7 8 9 7 8 9 7 8 9 6 7 8 7 8 9 4 5 6 3 4 5
transpose(DM)
ans = 15×8
6 9 7 6 6 4 7 7 7 9 8 7 7 5 8 8 8 9 9 8 8 6 9 9 7 1 1 2 1 3 4 6 8 2 2 3 2 4 5 7 9 3 3 4 3 5 6 8 7 1 1 3 3 2 2 7 8 2 2 4 4 3 3 8 9 3 3 5 5 4 4 9 4 6 7 5 6 1 7 4
%but I want answer as "ANS" which is transpose "DM" if we not open DM in
%numeric form.
ANS=[Vg Pf Ab Vg Vg Gd Ab Ab;
Ab Wa Wa Nb Wa Pb Gd Vg;
Ab Wa Wa Pb Pb Nb Nb Ab;
Gd Vg Ab Fg Vg Wa Ab Gd;
Vg Vg Pf Ab Vg Vg Ab Pb;]

답변 (1개)

Balavignesh
Balavignesh 2024년 7월 4일 9:40
HI Ashutosh,
I understand that you would like to transpose a matrix of triangular fuzzy numbers without expanding it into numeric form. Although it's not straightforward, I tried thinking of a workaround. I used a cell array to store the labels of the fuzzy numbers. I defined the fuzzy numbers as lables and created the matrix 'DM' using these labels. In this way, the labels are preserved, and you get the transposed matrix without converting the fuzzy numbers into numeric form.
To convert the transposed matrix 'ANS' into it's numeric form, I used a mapping from the fuzzy number labels to their corresponding numeric values. After the transpose operation, I finally converted 'ANS' to its numeric form by looking up each label in the 'fuzzy_numbers' mapping. The result is stored in 'numeric_ANS' and displayed.
The following code snippet could help you understand this concept better:
% Define the fuzzy numbers and their corresponding numeric values
fuzzy_numbers = {
'Eq', [1 1 1];
'Wa', [1 2 3];
'Nb', [2 3 4];
'Pb', [3 4 5];
'Gd', [4 5 6];
'Fg', [5 6 7];
'Vg', [6 7 8];
'Ab', [7 8 9];
'Pf', [9 9 9]
};
% Define the matrix DM using labels
DM = {
'Vg', 'Ab', 'Ab', 'Gd', 'Vg';
'Pf', 'Wa', 'Wa', 'Vg', 'Vg';
'Ab', 'Wa', 'Wa', 'Ab', 'Pf';
'Vg', 'Nb', 'Pb', 'Fg', 'Ab';
'Vg', 'Wa', 'Pb', 'Vg', 'Vg';
'Gd', 'Pb', 'Nb', 'Wa', 'Vg';
'Ab', 'Gd', 'Nb', 'Ab', 'Ab';
'Ab', 'Vg', 'Ab', 'Gd', 'Pb'
};
% Transpose the matrix DM
ANS = DM';
% Convert the transposed matrix ANS to numeric form
numeric_ANS = cell(size(ANS));
for i = 1:size(ANS, 1)
for j = 1:size(ANS, 2)
% Find the numeric value corresponding to the label
idx = find(strcmp(fuzzy_numbers(:, 1), ANS{i, j}));
numeric_ANS{i, j} = fuzzy_numbers{idx, 2};
end
end
% Display the transposed matrix in numeric form
disp('Transposed Matrix in Numeric Form (ANS):');
Transposed Matrix in Numeric Form (ANS):
disp(numeric_ANS);
{[6 7 8]} {[9 9 9]} {[7 8 9]} {[6 7 8]} {[6 7 8]} {[4 5 6]} {[7 8 9]} {[7 8 9]} {[7 8 9]} {[1 2 3]} {[1 2 3]} {[2 3 4]} {[1 2 3]} {[3 4 5]} {[4 5 6]} {[6 7 8]} {[7 8 9]} {[1 2 3]} {[1 2 3]} {[3 4 5]} {[3 4 5]} {[2 3 4]} {[2 3 4]} {[7 8 9]} {[4 5 6]} {[6 7 8]} {[7 8 9]} {[5 6 7]} {[6 7 8]} {[1 2 3]} {[7 8 9]} {[4 5 6]} {[6 7 8]} {[6 7 8]} {[9 9 9]} {[7 8 9]} {[6 7 8]} {[6 7 8]} {[7 8 9]} {[3 4 5]}
Kindly have a look at the following documentation links to have more information on:
Hope this helps!
Balavignesh

카테고리

Help CenterFile Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by