From a0e74fdeba3c429b264d87a2a4a6d11a7709f459 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 15 Apr 2025 09:56:08 +0200 Subject: [PATCH] Add disp and warning in Matlab code --- matlab/nass_1_active_damping.m | 12 ++++++++++-- simscape-nass.org | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/matlab/nass_1_active_damping.m b/matlab/nass_1_active_damping.m index cc68d21..47dd50c 100644 --- a/matlab/nass_1_active_damping.m +++ b/matlab/nass_1_active_damping.m @@ -268,8 +268,16 @@ xlim([freqs(1), freqs(end)]); %% Verify that parallel stiffness permits to have a stable plant Kiff_pure_int = -200/s*eye(6); -isstable(feedback(G_iff_m25_Rz, Kiff_pure_int, 1)) -isstable(feedback(G_iff_m25_Rz_no_kp, Kiff_pure_int, 1)) + +if not(isstable(feedback(G_iff_m25_Rz, Kiff_pure_int, 1))) + disp("Decentralized IFF is not stable with rotation") +end + +if isstable(feedback(G_iff_m25_Rz_no_kp, Kiff_pure_int, 1)) + disp("Parallel stiffness makes the decentralized IFF stable") +else + warning("Decentralized IFF is not stable even with the parallel stiffness") +end %% IFF Controller Design % Second order high pass filter diff --git a/simscape-nass.org b/simscape-nass.org index d5d4bb7..1a9365f 100644 --- a/simscape-nass.org +++ b/simscape-nass.org @@ -1176,8 +1176,16 @@ The overall gain was then increased to obtain a large loop gain around the reson #+begin_src matlab %% Verify that parallel stiffness permits to have a stable plant Kiff_pure_int = -200/s*eye(6); -isstable(feedback(G_iff_m25_Rz, Kiff_pure_int, 1)) -isstable(feedback(G_iff_m25_Rz_no_kp, Kiff_pure_int, 1)) + +if not(isstable(feedback(G_iff_m25_Rz, Kiff_pure_int, 1))) + disp("Decentralized IFF is not stable with rotation") +end + +if isstable(feedback(G_iff_m25_Rz_no_kp, Kiff_pure_int, 1)) + disp("Parallel stiffness makes the decentralized IFF stable") +else + warning("Decentralized IFF is not stable even with the parallel stiffness") +end #+end_src #+begin_src matlab