% plant example according to K.G. Papadopoulos, PID Controller Tuning 
% Using the Magnitude Optimum Criterion, Springer, 2015, p. 103/105
% here: ideal PID structure, no consideration of non-ideal D-terms

Vs5=1;
nump5=[ 1.5  1]; 
denop5=conv([1  0],conv([1 1],...
       conv([0.9638 1],conv([0.4061 1],conv([0.2392 1],[0.1751 1])))));

%FSdefault=optimset('fsolve');
%OPT=optimset(FSdefault,'Display','off','Diagnostics','off','TolFun',1e-24,...
%                 'Algorithm','trust-region-reflective','FinDiffType','forward',...
%                 'TolX',1e-24);
% Algorithm for fsolve must be: 'trust-region-reflective',
%  'levenberg-marquardt', 'trust-region-dogleg',
% FinDiffType: must be 'forward' or 'central'
%OPT=optimset('fsolve');
%OPT=optimset(OPT,'Display','off','Diagnostics','off',...
%                       'MaxFunEvals',4000);
[REGdE5PI,A2,Flag]=bo_d_gen(12,Vs5,nump5,denop5);
REGdE5PI, A2, Flag,

[REGdE5PID_av,A2,A3]=bo_d_gen(13,Vs5,nump5,denop5);
REGdE5PID_av, A2, A3,

nump5S=1
[REGdE5PID,A2,A3]=bo_d_gen(13,Vs5,nump5S,denop5);
REGdE5PID, A2, A3,

disp('"Pp_t2ex5_sim.slx" will be called - compare parameters')
Pp_t2ex5_sim; sim('Pp_t2ex5_sim',100),
disp('Repeat bo_d_gen call at MATLAB promt, if search algorithm fails')
