% FI.M %---------------------------------------------------------------- % Fuzzifiction Procedure % FUZZY.M will use this function, FI.m %---------------------------------------------------------------- function membership=fi(u) %---------------------------------------------------------------- % DEFINE THE RANGE OF THE FUZZY SETS %---------------------------------------------------------------- up2=2/3;up1=1/3; un2=-2/3; un1=-1/3; %-------------------------------------------------------------- % Initialize the membership function %-------------------------------------------------------------- pbu=0; pmu=0; psu=0; zeu=0; nbu=0; nmu=0;nsu=0; %------------------------------------------------------------- % Fuzzification %------------------------------------------------------------ if u >=1,pbu=1; elseif u >=up2, pbu=(u-up2)/(1-up2); pmu=(1-u)/(1-up2); elseif u >=up1, pmu=(u-up1)/(up2-up1); psu=(up2-u)/(up2-up1); elseif u >=0, psu=u/up1; zeu=1-u/up1; elseif u >=un1, zeu=(un1-u)/un1; nsu=u/un1; elseif u >=un2, nsu=(u-un2)/(un1-un2); nmu=(un1-u)/(un1-un2); elseif u >=-1, nmu=(1+u)/(1+un2); nbu=(un2-u)/(1+un2); else nbu=1; end; %--------------------------------- % Assign outputvector %--------------------------------- membership(:,1)=[pbu pmu psu zeu nsu nmu nbu]'; %---------------------------------------------------------------