clear;
format long
% Hasil REKAP
Kp = [0.554577220576924
   0.554477220576924
   0.554377220576924
   0.554277220576924
   0.554177220576924];
;
Kd = [6.552720021533880
    6.553720021533881
    6.554720021533881
    6.555720021533880
    6.556720021533880
    6.557720021533880
    6.558720021533880
    6.559720021533880
    6.560720021533880
    6.561720021533880
    6.562720021533880
    6.563720021533880];
N = length(Kp);
M = length(Kd);
Count = 0;
for i = 1:N
    x = Kp(i);
    for j = 1:M
        y = Kd(j);
        Count = Count + 1
        sim('Motor_DC_Experiment_var_Kp_Kd',200);
        k = length(J);
        z(i,j) = J(k);
    end
end
clf
mesh(Kp,Kd,z),grid on, xlabel('Kp'), ylabel('Kd'), zlabel('J')
pause
surf(Kp,Kd,z),grid on, xlabel('Kp'), ylabel('Kd'), zlabel('J')
