clear all
close all
clc
legend('off');
legend('show');
Vref=0.1;
gamma=0.1;
Kd=1:1:6;
Kp=1:1:6;
Ki=1:1:6;
cor=[[1 1 0]; [1 0 1]; [0 1 1]; [1 0 0]; [0 1 0]; [0 0 1]; [0 0 0]]
for i = 1:size(Kd,2)
K_d=Kd(i);
for j= 1:size(Kp,2)
K_p=Kp(j);
info=sim('diagrama_blocos');
Vt_out=info.Vt.signals.values(:,1);
Vt_ref_out=info.Vt.signals.values(:,2);
time_out=info.Vt.time;
plot(time_out,Vt_out,'LineWidth',2,'Color', cor(j,:));grid on;hold all;
line([time_out(1),time_out(end)],[Vref,Vref]);
legendInfo{j}=['Kp= ', num2str(K_p)];
title(['Curvas para Kd= ', num2str(K_d)]);
end
legend(legendInfo)
figure()
end
Best Answer