From 1c844e165055fca5253ed885af8c036619e9fef0 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Fri, 24 May 2024 11:06:18 +0200 Subject: Add more checks, update DK iteration --- uav_sim_step.m | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'uav_sim_step.m') diff --git a/uav_sim_step.m b/uav_sim_step.m index 973a928..82c05e9 100644 --- a/uav_sim_step.m +++ b/uav_sim_step.m @@ -22,6 +22,16 @@ P_nom_clp = minreal(usys_clp(... model.uncertain.index.OutputPlots], ... model.uncertain.index.InputExogenous), [], false); +% Check that closed loop is actually stable +eigvals = eig(P_nom_clp.A); +nx = size(P_nom_clp.A, 1); + +for i = 1:nx + if real(eigvals(i)) >= 0 + error('Closed loop is not stable!'); + end +end + % Indices for exogenous inputs Iwwind = (1:3)'; Iwalpha = (4:7)'; @@ -236,10 +246,10 @@ if do_plots hold on; step(P_nom_clp(Iomega, Ir(3)) * to_rpm, T); - plot([0, T], [1, 1] * omega_min_rpm, 'r--'); - plot([0, T], [1, 1] * omega_max_rpm, 'r--'); + % plot([0, T], [1, 1] * omega_min_rpm, 'r--'); + % plot([0, T], [1, 1] * omega_max_rpm, 'r--'); grid on; - ylim([omega_min_rpm - 1, omega_max_rpm + 1]); + % ylim([omega_min_rpm - 1, omega_max_rpm + 1]); title('Vertical $z$ to Thruster $\omega$', 'Interpreter', 'latex'); ylabel('Angular Velocity (RPM)', 'Interpreter', 'latex'); xlabel('Time (seconds)', 'Interpreter', 'latex'); -- cgit v1.2.1