% experiment 3 
% Martin Radvansky 
% Diplomova prace 2022
% Vytvoreni prazdneho FIS typu sugeno v kodu bez pouziti editoru IDE Matlabu

function [sugeno_fis] = make_raw_fis_sug(inputs_vec_range,output_vec_range,intervalyMF)
sugeno_fis = sugfis("NumInputs",1,"NumInputMFs",5,"NumOutputs",1,"NumOutputMFs",5);

sugeno_fis.Name = "Sugeno_aprox";
sugeno_fis.Inputs.Range = inputs_vec_range; 
sugeno_fis.Outputs.Range = output_vec_range; 

% Nastaveni vystupnich funkci
sugeno_fis.Outputs.MembershipFunctions(1, 1).Type = "linear";  
sugeno_fis.Outputs.MembershipFunctions(1, 2).Type = "linear";  
sugeno_fis.Outputs.MembershipFunctions(1, 3).Type = "linear";  
sugeno_fis.Outputs.MembershipFunctions(1, 4).Type = "linear";  
sugeno_fis.Outputs.MembershipFunctions(1, 5).Type = "linear";  

% Nastaveni pravidel
sugeno_fis.Rules(1, 1).Consequent = 1;
sugeno_fis.Rules(1, 2).Consequent = 2;
sugeno_fis.Rules(1, 3).Consequent = 3;
sugeno_fis.Rules(1, 4).Consequent = 4; 
sugeno_fis.Rules(1, 5).Consequent = 5; 

% Nastaveni funkci přislušnosti
sugeno_fis.Inputs.MembershipFunctions(1, 1).Parameters  = [intervalyMF(1,1)-intervalyMF(1,1)/5, ...
    (intervalyMF(1,1) + ((intervalyMF(1,2)-intervalyMF(1,1))/2)), intervalyMF(1,2)];  
sugeno_fis.Inputs.MembershipFunctions(1, 2).Parameters  = [intervalyMF(2,1), ...
    (intervalyMF(2,1) + ((intervalyMF(2,2)-intervalyMF(2,1))/2)),intervalyMF(2,2)];
sugeno_fis.Inputs.MembershipFunctions(1, 3).Parameters  = [intervalyMF(3,1), ...
    (intervalyMF(3,1) + ((intervalyMF(3,2)-intervalyMF(3,1))/2)),intervalyMF(3,2)];
sugeno_fis.Inputs.MembershipFunctions(1, 4).Parameters  = [intervalyMF(4,1), ...
    (intervalyMF(4,1) + ((intervalyMF(4,2)-intervalyMF(4,1))/2)),intervalyMF(4,2)];
sugeno_fis.Inputs.MembershipFunctions(1, 5).Parameters  = [intervalyMF(5,1), ...
    (intervalyMF(5,1) + ((intervalyMF(5,2)-intervalyMF(5,1))/2)),intervalyMF(5,2)+intervalyMF(5,2)/2];

% Nastaveni vah pro vystupni funkce
 sugeno_fis.Rules(1, 1).Weight = 1; % jedno cislo vaha 0-1 pravidla
 sugeno_fis.Rules(1, 2).Weight = 1;  
 sugeno_fis.Rules(1, 3).Weight = 1; 
 sugeno_fis.Rules(1, 4).Weight = 1; 
 sugeno_fis.Rules(1, 5).Weight = 1; 
end

