clear;clc;
M=100; m=200; L=5; T=5; s=10; Mi=0.01; g=9.81;
out=sim("suwnicapid.slx");
%% generowanie sieci
u=[out.u1,out.du1,out.iu1,out.u2,out.du2]; y=out.y;
opt = genfisOptions('GridPartition');
opt.NumMembershipFunctions = [2 2 2 2 2];
opt.InputMembershipFunctionType = 'gaussmf';
opt.OutputMembershipFunctionType = 'constant';
fisin = genfis(u,y,opt);
[in,out,rule] = getTunableSettings(fisin);
opt = tunefisOptions("Method","anfis");
opt.MethodOptions.EpochNumber = 100;
fis = tunefis(fisin,[in;out],u,y,opt);
%% zapisany sugeno 0 rzedu
%fis = readfis("pid02.fis");
%% zapisany sugeno 1 rzedu
%fis = readfis("pid12.fis");
%%
warning('off','all')
out2=sim("suwnicafuzzypid.slx");