clear
clf
Ki = 0;
varKp = [0:5:100];
varKd = [0:0.5:10];
J = length(varKp);
I = length(varKd);
for i = 1:I
    Kd = varKd(i);
    for j = 1:J
        Kp = varKp(j);
        sim('Project_3_2018.mdl')
        N = length(RMSE);
        x(i) = Kd;
        y(j) = Kp;
        z(j,i) = RMSE(N);
        M1 = j
    end
    clc
    M2 = i
end
mesh(x,y,z), xlabel('Kd'), ylabel('Kp'), zlabel('RMSE[Volt]')