Untitled

 avatar
unknown
plain_text
a year ago
7.9 kB
5
Indexable
fis = mamfis('Name',"TipMamdani");

%inputs m,s,rho
fis = addInput(fis,[0 1],"Name","Mean Delay");
fis = addInput(fis,[0 1],"Name","number of servers");
fis = addInput(fis,[0 1],"Name","Repair utilisation factor");

%MF for mean delay 
fis = addMF(fis,"Mean Delay","trapmf",[0 0 0.1 0.3],"Name","VS");
fis = addMF(fis,"Mean Delay","trimf",[0.1 0.3 0.5],"Name","S");
fis = addMF(fis,"Mean Delay","trapmf",[0.4 0.6 0.7 0.7],"Name","M");
plotmf(fis,"input",1);
%MF for servers
fis = addMF(fis,"number of servers","trapmf",[0 0 0.2 0.35],"Name","S");
fis = addMF(fis,"number of servers","trimf",[0.15 0.3 0.45],"Name","RS");
fis = addMF(fis,"number of servers","trimf",[0.3 0.5 0.7],"Name","M");
fis = addMF(fis,"number of servers","trimf",[0.55 0.7 0.85],"Name","RL");
fis = addMF(fis,"number of servers","trapmf",[0.6 0.8 1 1],"Name","L");
plotmf(fis,"input",2);
%MF for repair utilisation factor
fis = addMF(fis,"Repair utilisation factor","trapmf",[0 0 0.4 0.6],"Name","L");
fis = addMF(fis,"Repair utilisation factor","trimf",[0.4 0.6 0.8],"Name","M");
fis = addMF(fis,"Repair utilisation factor","trapmf",[0.6 0.8 1 1],"Name","H");
plotmf(fis,"input",3);

% add the output
fis = addOutput(fis,[0 1],"Name","Number of spares");

%MF for output
fis = addMF(fis,"Number of spares","trapmf",[0 0 0.1 0.3],'Name',"VS");
fis = addMF(fis,"Number of spares","trimf",[0 0.2 0.4],'Name',"S");
fis = addMF(fis,"Number of spares","trimf",[0.25 0.35 0.45],'Name',"RS");
fis = addMF(fis,"Number of spares","trimf",[0.3 0.5 0.7],'Name',"M");
fis = addMF(fis,"Number of spares","trimf",[0.55 0.65 0.75],'Name',"RL");
fis = addMF(fis,"Number of spares","trimf",[0.6 0.8 1],'Name',"L");
fis = addMF(fis,"Number of spares","trapmf",[0.7 0.9 1 1],'Name',"VL");
plotmf(fis,"output",1);

% define rules 
rule1 = "If Mean Delay is VS and number of servers is S and Repair utilisation factor is L then Number of spares is VS";
rule2 = "If Mean Delay is S and number of servers is S and Repair utilisation factor is L then Number of spares is VS";
rule3 = "If Mean Delay is M and number of servers is S and Repair utilisation factor is L then Number of spares is VS";
rule4 = "If Mean Delay is VS and number of servers is RS and Repair utilisation factor is L then Number of spares is VS";
rule5 = "If Mean Delay is S and number of servers is RS and Repair utilisation factor is L then Number of spares is VS";
rule6 = "If Mean Delay is M and number of servers is RS and Repair utilisation factor is L then Number of spares is VS";
rule7 = "If Mean Delay is VS and number of servers is M and Repair utilisation factor is L then Number of spares is VS";
rule8 = "If Mean Delay is S and number of servers is M and Repair utilisation factor is L then Number of spares is VS";
rule9 = "If Mean Delay is M and number of servers is M and Repair utilisation factor is L then Number of spares is VS";
rule10 = "If Mean Delay is VS and number of servers is RL and Repair utilisation factor is L then Number of spares is S";
rule11 = "If Mean Delay is S and number of servers is RL and Repair utilisation factor is L then Number of spares is S";
rule12 = "If Mean Delay is M and number of servers is RL and Repair utilisation factor is L then Number of spares is VS";
rule13 = "If Mean Delay is VS and number of servers is L and Repair utilisation factor is L then Number of spares is S";
rule14 = "If Mean Delay is S and number of servers is L and Repair utilisation factor is L then Number of spares is S";
rule15 = "If Mean Delay is M and number of servers is L and Repair utilisation factor is L then Number of spares is VS";
rule16 = "If Mean Delay is VS and number of servers is S and Repair utilisation factor is M then Number of spares is S";
rule17 = "If Mean Delay is S and number of servers is S and Repair utilisation factor is M then Number of spares is VS";
rule18 = "If Mean Delay is M and number of servers is S and Repair utilisation factor is M then Number of spares is VS";
rule19 = "If Mean Delay is VS and number of servers is RS and Repair utilisation factor is M then Number of spares is S";
rule20 = "If Mean Delay is S and number of servers is RS and Repair utilisation factor is M then Number of spares is VS";
rule21 = "If Mean Delay is M and number of servers is RS and Repair utilisation factor is M then Number of spares is VS";
rule22 = "If Mean Delay is VS and number of servers is M and Repair utilisation factor is M then Number of spares is RS";
rule23 = "If Mean Delay is S and number of servers is M and Repair utilisation factor is M then Number of spares is S";
rule24 = "If Mean Delay is M and number of servers is M and Repair utilisation factor is M then Number of spares is VS";
rule25 = "If Mean Delay is VS and number of servers is RL and Repair utilisation factor is M then Number of spares is M";
rule26 = "If Mean Delay is S and number of servers is RL and Repair utilisation factor is M then Number of spares is RS";
rule27 = "If Mean Delay is M and number of servers is RL and Repair utilisation factor is M then Number of spares is S";
rule28 = "If Mean Delay is VS and number of servers is L and Repair utilisation factor is M then Number of spares is M";
rule29 = "If Mean Delay is S and number of servers is L and Repair utilisation factor is M then Number of spares is RS";
rule30 = "If Mean Delay is M and number of servers is L and Repair utilisation factor is M then Number of spares is S";
rule31 = "If Mean Delay is VS and number of servers is S and Repair utilisation factor is H then Number of spares is VL";
rule32 = "If Mean Delay is S and number of servers is S and Repair utilisation factor is H then Number of spares is L";
rule33 = "If Mean Delay is M and number of servers is S and Repair utilisation factor is H then Number of spares is M";
rule34 = "If Mean Delay is VS and number of servers is RS and Repair utilisation factor is H then Number of spares is VL";
rule35 = "If Mean Delay is S and number of servers is RS and Repair utilisation factor is H then Number of spares is RL";
rule36 = "If Mean Delay is M and number of servers is RS and Repair utilisation factor is H then Number of spares is RS";
rule37 = "If Mean Delay is VS and number of servers is M and Repair utilisation factor is H then Number of spares is M";
rule38 = "If Mean Delay is S and number of servers is M and Repair utilisation factor is H then Number of spares is M";
rule39 = "If Mean Delay is M and number of servers is M and Repair utilisation factor is H then Number of spares is S";
rule40 = "If Mean Delay is VS and number of servers is RL and Repair utilisation factor is H then Number of spares is RL";
rule41 = "If Mean Delay is S and number of servers is RL and Repair utilisation factor is H then Number of spares is M";
rule42 = "If Mean Delay is M and number of servers is RL and Repair utilisation factor is H then Number of spares is RS";
rule43 = "If Mean Delay is VS and number of servers is L and Repair utilisation factor is H then Number of spares is L";
rule44 = "If Mean Delay is S and number of servers is L and Repair utilisation factor is H then Number of spares is M";
rule45 = "If Mean Delay is M and number of servers is L and Repair utilisation factor is H then Number of spares is RS";

rules = [rule1 rule2 rule3 rule4 rule5 rule6 rule7 rule8 rule9 rule10 rule11 rule12 rule13 rule14 rule15 rule16 rule17 rule18 rule19 rule20 rule21 rule22 rule23 rule24 rule25 rule26 rule27 rule28 rule29 rule30 rule31 rule32 rule33 rule34 rule35 rule36 rule37 rule38 rule39 rule40 rule41 rule42 rule43 rule44 rule45];

% Add the rules to the FIS.
fis = addRule(fis,rules);
% Display the rules
fis.Rules
% To get output from fis
evalfis(fis,[1 2 3]);
% plotfis displays the whole system as a block diagram.
plotfis(fis);
% Generate fuzzy inference system output surface
gensurf(fis)

Editor is loading...
Leave a Comment