Files
Appunti-controlli-automatici/images/Immagini.m

120 lines
2.6 KiB
Matlab

%% Rete lead
clear
clf
s = tf('s');
figure(1)
for m_d = 3:16
Rz = (1+s)/(1+s/m_d);
bode(Rz)
grid on
hold on
end
title("Lead network")
saveas(gcf,'retelead.png')
%% Rete lag
clear
clf
s = tf('s');
figure(2)
for m_d = 3:16
Rz = (1+s/m_d)/(1+s);
bode(Rz)
grid on
hold on
end
title("Lag network")
saveas(gcf,'retelag.png')
%% Rete zero
clear
clf
s = tf('s');
figure(3)
Rz = (1+s);
bode(Rz)
grid on
title("Zero network")
saveas(gcf,'retezero.png')
%% Plots riguardo ad un generico sistema ad anello
clear
clf
omega_c = 690;
s = tf('s');
L = (1.498e14*s^2 + 8.615e16*s + 1.189e19)/(79350*s^5 + 3.468e08*s^4 + 2.732e11*s^3 + 7.539e13*s^2 + 6.611e15*s)
T = L/(1+L);
S = 1/(1+L);
figure(1)
bodemag(T)
hold on
grid on
[mag,~,wout] = bode(T,omega_c);
text(wout,mag2db(mag),'Tp','Color','red','FontSize',14, 'VerticalAlignment','bottom')
title("T(j \omega)")
xline(omega_c, '--b', "\omega_c", 'LabelOrientation','horizontal','LabelVerticalAlignment','bottom','FontSize',14)
saveas(gcf,'bodeT.png')
figure(2)
bodemag(S);
hold on
grid on
[mag,~,wout] = bode(S,omega_c);
text(wout,mag2db(mag),'Sp','Color','red','FontSize',14, 'VerticalAlignment','bottom')
xline(omega_c, '--b', "\omega_c", 'LabelOrientation','horizontal','LabelVerticalAlignment','bottom','FontSize',14)
title("S(j \omega)")
saveas(gcf,'bodeS.png')
figure(3)
bodemag(L)
hold on
grid on
bodemag(S)
bodemag(T)
xline(omega_c, '--b', "\omega_c", 'LabelOrientation','horizontal','LabelVerticalAlignment','bottom','FontSize',14)
legend
saveas(gcf,'lts.png')
figure(4)
bode(L)
hold on
xline(omega_c, '--b', "\omega_c", 'LabelOrientation','horizontal','LabelVerticalAlignment','bottom','FontSize',14)
title("L(j \omega)")
grid on
saveas(gcf,'plotljw.png')
%% Step response
clear
clf
s = tf('s');
T = 6.9846e09*s*(s+3450)*(s+2760)*(s+400)*(s+345)*(s+230)*(s+175)/(s*(s+4410)*(s+3450)*(s+2760)*(s+400)*(s+175)*(s^2 + 557.1*s + 7.863e04)*(s^2 + 1818*s + 1.598e06));
figure(1)
step(T)
hold on
grid on
xline(0.00292, '--b', "t_r", 'LabelOrientation','horizontal','LabelVerticalAlignment','bottom','FontSize',14)
yline(1, '--b', "y_\infty", 'LabelOrientation','horizontal','LabelVerticalAlignment','bottom','FontSize',14)
yline(1.05, '--b', "y_{max}", 'LabelOrientation','horizontal','LabelVerticalAlignment','top','FontSize',14)
saveas(gcf,'transitorio.png')
%% Step response second order system
clear
clf
s = tf('s');
t = linspace(0,20,1000);
figure(1)
for xi = 0:0.1:1
Rz = 1/(1+2*xi*s+s^2);
step(Rz,t)
hold on
grid on
end
title("Step response of prototype second order system")
saveas(gcf,'rispostasecondoordine.png')