clear
Ki = 2.739663529403798;
Kd = 4.135669086967992;
Kp = 5.024740183063027;
p=2.75;
q=1;
VarK = [0:0.1:2];
k = 0;
N = length(VarK);
for I = 1:N,
    clc
    k = k+1
    K = VarK(I);
    sim('DC_Motor_Simulation');
    n = length(J);
    J_K(I) = J(n);
    U_K(I) = U(n);
    E_K(I) = E(n);
end
clf
plot(VarK,J_K,VarK,E_K,VarK,U_K),grid on, xlabel('K'), ylabel('J, E and U')