- Cell Arrays: https://www.mathworks.com/help/matlab/ref/cell.html
- Transpose: https://www.mathworks.com/help/matlab/ref/transpose.html
Need help in transpose of triangular fuzzy matrix
1 次查看(过去 30 天)
显示 更早的评论
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;]
transpose(DM)
%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;]
0 个评论
回答(1 个)
Balavignesh
2024-7-4
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):');
disp(numeric_ANS);
Kindly have a look at the following documentation links to have more information on:
Hope this helps!
Balavignesh
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Clustering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!