clc;
clear;
% close all;
%%
system = zpk([] , [-1 -1 -1] , 1) ;
options = pidtuneOptions('PhaseMargin' , 45 , 'DesignFocus' , 'reference-tracking' );
[Gc , info] = pidtune(system ,'pidf' , options) ;
%%
figure(1) ;
subplot(211) ; 
step(system, feedback(system*Gpid , 1) , feedback(system*Gpidf , 1)); hold on
legend('Open Loop','Closed Loop - PID' , 'Closed Loop - PIDF') ; 

subplot(212) ; 
step(system/(1 + system*Gpid) , system/(1 + system*Gpidf)); hold on
legend('Disturbance Response - PID' , 'Disturbance Response - PIDF' ); 

figure(2) ; 
step(Gpid/(1 + system*Gpid)/tf([0.0001 1],1) , Gpidf/(1 + system*Gpidf)); hold on
legend('Closed Loop - PID' , 'Closed Loop - PIDF') ; 
title('Effort Control - u') ; 
