fis = addInput(fis, [-1.5 +1.5], 'Name', 'Err');
fis = addMF(fis, 'Err', 'linzmf', [-crn  0.0     ], 'Name', 'N');
fis = addMF(fis, 'Err',  'trimf', [-crn  0.0  crn], 'Name', 'Z');
fis = addMF(fis, 'Err', 'linsmf', [      0.0  crn], 'Name', 'P');
fis = addOutput(fis,  [lb ub], 'Name', 'Kp');
fis = addMF(fis, 'Kp', 'trimf', [lb lb lb], 'Name', 'L');
fis = addMF(fis, 'Kp', 'trimf', [ub ub ub], 'Name', 'H');
fis = addRule(fis, rules);
tL1     = tiledlayout(2, 1, 'TileSpacing', 'Compact');
plotmf(fis,  'input', 1, numpts), grid on, 
title('Input fuzzy sets')
plotmf(fis, 'output', 1, numpts), grid on, xlim([1.1, 1.8])
title('Output fuzzy sets')
opt = gensurfOptions('NumGridPoints', numpts);
gensurf(fis, opt); ylim([1.2, 1.7])
title('Mamdani Fuzzy Kp gain scheduler')
function dx = ode(t, x, A, B, fis)
[t, x]  = ode45(@(t, x) ode(t, x, A, B, fis), [0 5], [0; 0]);
plot(t, x(:,1)), grid on, grid minor
xlabel('Time / s'), ylabel('x(t)'), title('Step response')
S       = stepinfo(y, t, yfinal);
disp('The Settling Time is: '); disp(S.SettlingTime)
The Settling Time is: 
    2.0047
disp('The Max Overshoot is: '); disp(S.Overshoot)
The Max Overshoot is: 
    0.1005