For robustness, require at least 6 dB of gain margin and 40 degrees of phase margin at
the plant input.% Stability margins
req3 = TuningGoal.Margins('F',6,40);Finally, constrain the damping and natural frequency of the closed-loop poles to prevent
jerky or underdamped transients.% Pole locations
MinDamping = 0.5;
MaxFrequency = 45;
req4 = TuningGoal.Poles(0,MinDamping,MaxFrequency);Control System TuningThe closed-loop system is unstable for the initial values of the PD and state-space
controllers (1 and , respectively). You can use systune to jointly tune these two
controllers. Use the slTuner interface to specify the tunable blocks and register the
plant input F as an analysis point for measuring stability margins.ST0 = slTuner('rct_pendulum',{'Position Controller','Angle Controller'});
addPoint(ST0,'F');Next, use systune to tune the PD and state-space controllers subject to the performance
requirements specified above. Optimize the tracking and disturbance rejection
performance (soft requirements) subject to the stability margins and pole location
constraints (hard requirements).rng(0)
Options = systuneOptions('RandomStart',5);
[ST, fSoft] = systune(ST0,[req1,req2],[req3,req4],Options);Final: Soft = 1.36, Hard = 0.99949, Iterations = 296
Final: Soft = 1.44, Hard = 0.99942, Iterations = 164
Final: Soft = 1.27, Hard = 0.99966, Iterations = 293
Final: Soft = 1.27, Hard = 0.99363, Iterations = 194
Final: Soft = 1.44, Hard = 0.9996, Iterations = 234
Final: Soft = 1.26, Hard = 0.99933, Iterations = 345The best design achieves a value close to 1 for the soft requirements while satisfying the
hard requirements (Hard<1). This means that the tuned control system nearly achieves
the target performance for tracking and disturbance rejection while satisfying the
stability margins and pole location constraints.13 Control System Tuning Examples