%
% FIRST ORDER ADATIVE CONTROLLER
%
% Reference Model Gr(s) = 1/(s+a)
    a = 5;
% Unknown Plant Gp(s) = K/(s+b)
    K = 1;
    b = 10;
% Adaptive Controller H(s) = int[dKp = myu*Error], Kp(0) = Kp0
    Kp0 = 0;
    myu = -10;
% Simulation
    sim('first_order.slx');
% Results
    subplot(311), plot(time, Yr, time, Yp), grid on, xlabel('time [sec]'), ylabel('output')
    subplot(312), plot(time, error), grid on, xlabel('time [sec]'), ylabel('error')
    subplot(313), plot(time, Kp), grid on, xlabel('time [sec]'), ylabel('Kp')
% Final Results
    N = length(error);
    Final_ERROR = error(N)
    Final_Kp = Kp(N)
    


    