how to process the output of fuzzy interface system(chance parameter) to select the indexes of first 3 maximum chance values???

2 views (last 30 days)
My project is " clustering in wireless sensor network using Fuzzy logic", Am doing this for 60 nodes. In this project the node with the maximum chance value will become the cluster head. the chance values for all 60 node is stored in the array variable "LQ", i need to select the 3 cluster head with maximum chance parameter to do this i need the indexes of the first 3 maximum chance parameter. here i need the indexes value......
  2 Comments
jithendra kumar
jithendra kumar on 17 Jan 2018
close all; clear all; %Field Dimensions - x and y maximum (in meters) xm=120; ym=120; sink.x=0.5*xm; sink.y=0.5*ym; n=60; p=0.1; Eo=0.1; ETX=50*0.000000001; ERX=50*0.000000001; Efs=10*0.000000000001; Emp=0.0013*0.000000000001; EDA=5*0.000000001; do=sqrt(Efs/Emp); figure(1); for i=1:1:n S(i).xd=rand(1,1)*xm; XR(i)=S(i).xd; S(i).yd=rand(1,1)*ym; YR(i)=S(i).yd; plot(S(i).xd,S(i).yd,'o');
hold on;
end
S(n+1).xd=sink.x; S(n+1).yd=sink.y; plot(S(n+1).xd,S(n+1).yd,'+'); figure(1); distance=sqrt( (S(i).xd-(S(n+1).xd) )^2 + (S(i).yd-(S(n+1).yd) )^2 );
i have done upto this much, including the Membership functions in fuzzy tool bar. But i am not able to move further, this is because i am not in a situation to interface fuzzy to matlab.

Sign in to comment.

Accepted Answer

Arkadiy Turevskiy
Arkadiy Turevskiy on 20 Mar 2014
Ok, I see, not really a Fuzzy Logic question, more of a basic MATLAB question.
x=rand(60,1); %test vactor of 60 random numbers
[svals,idx]=sort(x,'descend'); %sort in descending order
svals(1:3) %the 3 largest values
idx(1:3) % the indices of 3 largest values

More Answers (1)

Arkadiy Turevskiy
Arkadiy Turevskiy on 19 Mar 2014
Please provide detailed description of what you did and specific questions about your code.

Categories

Find more on Fuzzy Logic in Simulink 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!