%PI controller example
Kc=0.36;
tauI=10.8;
tauD=0.1;
beta=0.1;
tauf=beta*tauD;
num=1;
den1=[1 0];
den2=conv([1 1],[1 1]);
den3=conv(den2,[1 1]);
den=conv(den1,den3);
deltat=0.01;
Tsim=100;
sim('PIDController');
figure(1)
hold on
plot(t,y,'LineWidth',2,'Color',[.6 0 0])
tauD=1;
tauf=beta*tauD;
sim('PIDController');
figure(1)
plot(t,y)
set(gca,'FontSize',20,'FontName','helvetica');
legend('tauD=0.1','tauD=1')
axis([-1 60 -1 2])
xlabel('Time (sec)')
%alternative structure
tauD=0.1;
sim('PIDController_A');
figure(2)
hold on
plot(t,y,'LineWidth',2,'Color',[.6 0 0])
tauD=1;
tauf=beta*tauD;
sim('PIDController_A');
figure(2)
plot(t,y)
set(gca,'FontSize',20,'FontName','helvetica');
legend('tauD=0.1','tauD=1')
axis([-1 60 -1 2])
xlabel('Time (sec)')
