Clear Filters
Clear Filters

choose a part of matrix with an condition

2 views (last 30 days)
Bashar AlHalaq
Bashar AlHalaq on 1 Feb 2022
Commented: Arif Hoq on 2 Feb 2022
i have the following code:
clc; clear all; close all;
lamda=1;
n=100;m=10;
for i=1:n
u=rand;
t(i)=-log(1-u)./lamda;
end
aa=min(t);aaa=max(t);
alpha=(t-aa)./(aaa-aa);
cut=alpha';
x=t';
fs =sort([x cut]);
result the follwling fuzzy set
0.0251095217432329 0
0.0259813666329032 0.000157215256236631
0.0343724949438669 0.00167034379911478
0.0365119840971735 0.00205614675493619
0.0444796386769595 0.00349291248150910
0.0685101096620772 0.00782620237994602
0.0729419959197381 0.00862538138743353
0.0729823212975833 0.00863265305316889
0.0771056967721968 0.00937619991509561
0.0782934192059375 0.00959037572660854
0.0942481070214086 0.0124674016320231
0.118104923234842 0.0167693772683126
0.132928037723898 0.0194423524388193
0.141464614937633 0.0209817090261459
0.150486651883491 0.0226086060430634
0.160165769148197 0.0243539909377214
0.162624667685636 0.0247973913271754
0.174022001792908 0.0268526133320516
0.177437098264183 0.0274684399236455
0.186089797358388 0.0290287361659603
0.192389357916822 0.0301647031700760
0.193639507619337 0.0303901361664079
0.198540620337461 0.0312739283420046
0.230425224929311 0.0370235133201386
0.243585467389849 0.0393966314230066
0.246461893804786 0.0399153224438845
0.277901483165116 0.0455846601389507
0.291537135509796 0.0480435064345724
0.309915334323799 0.0513575514785294
0.319423270431970 0.0530720681651994
0.334011019687199 0.0557026011467529
0.357922356879197 0.0600144082676525
0.364889059485256 0.0612706775287480
0.365435326188982 0.0613691829633927
0.443159715125493 0.0753848179315693
0.449823839934316 0.0765865249115897
0.468569891981819 0.0799669030166767
0.513582634608457 0.0880838168734941
0.554022281661509 0.0953760881810300
0.581646474411458 0.100357415241576
0.588036425496520 0.101509681899418
0.601783323397470 0.103988588527837
0.613498559211000 0.106101136094633
0.638552105558661 0.110618911854234
0.638916426867956 0.110684608021834
0.651875003547725 0.113021360782915
0.687205861775114 0.119392390762089
0.691297023750098 0.120130128731106
0.705899157309337 0.122763255559417
0.823433299288465 0.143957576323044
0.858045642838051 0.150199040285924
0.888157505568769 0.155628955940717
0.889518685776218 0.155874410490757
0.893463294721270 0.156585721313814
0.915285437208968 0.160520794815401
0.937878900953337 0.164594956669108
0.955028908877928 0.167687528435336
0.978256016710709 0.171875952033193
0.992685558782281 0.174477956335836
1.08909370982563 0.191862736987945
1.11174608686031 0.195947522369003
1.11550892269812 0.196626054992669
1.11575884057759 0.196671121384552
1.25770274616163 0.222267127912803
1.28429691903436 0.227062716843958
1.29259304165275 0.228558713504230
1.35119807040169 0.239126653651248
1.37659600127880 0.243706530482590
1.37747485674277 0.243865009919242
1.45006245198353 0.256954353586431
1.52626623667126 0.270695785896039
1.52631887410864 0.270705277731460
1.53674879873361 0.272586051813950
1.55574556165166 0.276011639306878
1.56381957936798 0.277467584944880
1.59033309595797 0.282248629547901
1.75485836515092 0.311916615975340
1.77673375075387 0.315861290531090
1.94447021196261 0.346108334519763
1.97521587492537 0.351652540075276
2.05646098147899 0.366303047747151
2.08463410738727 0.371383361070237
2.18820048893875 0.390058948214269
2.21500819936291 0.394893043261894
2.23664670373312 0.398795002256487
2.38362299297179 0.425298472365837
2.42209071247778 0.432235156230854
2.57895632620045 0.460521916809850
2.68559900772363 0.479752237134110
2.70979097605743 0.484114649009811
2.76197414497776 0.493524568561156
2.76341068061933 0.493783611564858
2.85507329914818 0.510312655010629
2.90563229743653 0.519429696315966
2.97068170733797 0.531159718211906
3.03761808247567 0.543230006738578
3.11245164225496 0.556724353514239
3.61120264525975 0.646661528881897
5.47375984678937 0.982526785607316
5.57065841146458 1
with two columns first the element of the set and the second represent the degree of membership of the element
How can i selecet a set from the fuzzy set above which contian the elements have a degree of membership greater than 0.5
with my best regurads

Answers (1)

Arif Hoq
Arif Hoq on 1 Feb 2022
Edited: Arif Hoq on 1 Feb 2022
Try this:
lamda=1;
n=100;m=10;
for i=1:n
u=rand;
t(i)=-log(1-u)./lamda;
end
aa=min(t);aaa=max(t);
alpha=(t-aa)./(aaa-aa);
cut=alpha';
x=t';
fs =sort([x cut]);
element_of_set=fs(:,1);
degree_of_membership=fs(:,2);
greater_value=degree_of_membership(degree_of_membership>0.5) % expexted value greater than 0.5
greater_value = 7×1
0.5102 0.5625 0.6472 0.7921 0.8183 0.8215 1.0000
  6 Comments
Arif Hoq
Arif Hoq on 2 Feb 2022
@Bashar AlHalaq If you find your answer, then please consider marking it as accepted answer. That will make it easier for others with similar issues to find an answer.

Sign in to comment.

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!