clear all; clc; close all; % CONTROLADORES PID pkg load control s = tf('s'); % define la variable de Laplace t = 0:0.01:5; %planta o proceso y1 = 1/(s+1); % SIN CONTROLADOR z1 = step(y1,t); % realiza la simulación cuando hay un escalón a la entrada plot(t,z1,'k') xlabel('t'); ylabel('y'); legend('sin control') pause % CONTROLADOR P K = 0.6;% ganancia del controlador y2 = y1/(1+K*y1); % salida controlador P + sl z2 = step(y2,t); hold on plot(t,z2,'b') legend('sin control','P') pause % CONTROLADOR PI tauI = .2; sis1 = K*(1+1/(tauI*s)); y3 = y1/(1+sis1*y1); z3 =step(y3,t); plot(t,z3,'g') legend('sin control','P','PI') pause % CONTROLADOR PID tauD = 10; sis2 = K*(1+1/(tauI*s)+tauD*s); y4 = y1/(1+sis2*y1); z4 = step(y4,t); plot(t,z4,'r') legend('sin control','P','PI','PID')