% 2. Check controllability & observability Co = ctrb(A,B); % controllability matrix Ob = obsv(A,C); % observability matrix assert(rank(Co)==size(A,1), 'System not controllable'); assert(rank(Ob)==size(A,1), 'System not observable');

% 5. (Optional) Design observer gain L % Desired observer poles are usually 5–10× faster: obsPoles = 5*desiredPoles; L = place(A',C',obsPoles)'; % dual problem

% 4. Compute state‑feedback gain K K = place(A,B,desiredPoles); % or: K = acker(A,B,desiredPoles);

| | Goal | Key Actions | Tips & Tricks | |----------|----------|----------------|-------------------| | A. Model Extraction | Convert the given description into ((\mathbfA,\mathbfB,\mathbfC,\mathbfD)). | • Write the differential equations. • Use the controllable canonical form (or observable, if convenient). • Verify by re‑deriving the original transfer function. | Shortcut : If a transfer function (G(s)=\fracN(s)D(s)) is given, the controllable canonical form is immediate—just place the coefficients of (D(s)) in the (\mathbfA) matrix and the numerator coefficients in (\mathbfB). | | B. Controllability/Observability Test | Ensure you can place poles anywhere you like (or know the limitations). | • Compute the controllability matrix (\mathcalC= [\mathbfB;\mathbfAB;\dots;\mathbfA^n-1\mathbfB]). • Compute the observability matrix (\mathcalO= [\mathbfC^\top;\mathbfA^\top\mathbfC^\top;\dots;(\mathbfA^n-1)^\top\mathbfC^\top]^\top). • Check rank = (n). | Quick test : If the system is in a canonical form, controllability (or observability) is guaranteed by construction. | | C. Desired Pole Set | Translate performance specs (e.g., 2 % overshoot, 0.5 s settling) into a target pole location. | • Use the standard second‑order formulas: (\zeta = -\ln(0.02)/\sqrt\pi^2+(\ln0.02)^2), ( \omega_n = 4/( \zeta , T_s )). • For higher‑order systems, append extra “fast” poles (e.g., at (-10\omega_n)). | Rule of thumb : Keep extra poles at least 5–10× farther left than the dominant pair to avoid affecting transient response. | | D. State‑Feedback Gain (\mathbfK) | Solve (\mathbfA cl= \mathbfA-\mathbfB\mathbfK) so that its eigenvalues = desired poles. | • Pole placement : Use Ackermann’s formula (hand‑calc) or place / acker in MATLAB. • LQR : Choose (Q,R) to shape the closed‑loop poles indirectly. | Numerical sanity check : After computing (\mathbfK), re‑calculate the eigenvalues of (\mathbfA cl) to confirm they match. | | E. Output‑Feedback (if required) | Design an observer or a compensator if only the output is measurable. | • Build the observer gain (\mathbfL) using a dual pole‑placement problem on (\mathbfA^\top, \mathbfC^\top). • Form the combined system (\beginbmatrix\mathbfA-\mathbfB\mathbfK & \mathbfB\mathbfK\ \mathbf0 & \mathbfA-\mathbfL\mathbfC\endbmatrix). | Tip : Separate the design of (\mathbfK) and (\mathbfL) unless you need a dynamic output feedback that couples them. | | F. Simulation & Validation | Prove that the design meets the specs. | • Write a simple ode45 script or use lsim for the closed‑loop system. • Plot step response, Bode plot, and control effort.\n• Compare settling time, overshoot, steady‑state error with the targets. | Debug : If the response deviates, revisit pole locations, verify model linearization, or check for hidden algebraic loops. | 4️⃣ Common Pitfalls (and How to Dodge Them) | Mistake | Why It Happens | Fix | |------------|-------------------|--------| | Skipping the controllability check | Assuming the textbook guarantees it. | Always run the rank test; a singular (\mathcalC) means you must redesign the state variables (e.g., via a similarity transform). | | Mis‑reading the sign convention | Using (s = +\sigma + j\omega) vs. the standard (s = -\sigma + j\omega). | Write the characteristic equation explicitly: (\det(s\mathbfI - (\mathbfA-\mathbfB\mathbfK)) = 0). | | Placing extra poles too close | Over‑constraining the system, leading to high gain and actuator saturation. | Keep “non‑dominant” poles at least a factor of 5–10 left of the dominant pair. | | Forgetting the feed‑forward term (if the problem asks for zero steady‑state error). | Only designing (\mathbfK) yields a type‑0 system. | Compute the reference gain (N = 1/(\mathbfC( -\mathbfA + \mathbfB\mathbfK)^-1\mathbfB)). | | Using MATLAB’s place without scaling | Numerical ill‑conditioning for high‑order systems. | Pre‑scale the state matrix or use lqr / care for a more robust solution. | 5️⃣ Quick MATLAB Cheat‑Sheet (Copy‑Paste Friendly) % ------------------------------------------------- % Problem 28 – State‑Space Design (Kuo 8th Ed.) % ------------------------------------------------- % 1. Define the plant A = [...]; % <-- fill in from the problem statement B = [...]; C = [...]; D = 0; % usually zero for control design

% 6. Closed‑loop matrices Acl = A - B*K; % state‑feedback only % If using observer: Acl_obs = [A-B*K, B*K; zeros(size(A)), A-L*C];

% 7. Simulate step response sys_cl = ss(Acl,B, C, D); figure; step(sys_cl); title('Closed‑loop step response (state‑feedback)');

% 3. Desired poles (example: 2% overshoot, 0.5 s Ts) zeta = 0.78; % approx. for 2% overshoot wn = 4/(zeta*0.5); % natural frequency p1 = -zeta*wn + 1i*wn*sqrt(1-zeta^2); p2 = conj(p1); extraPoles = -10*wn*ones(1,size(A,1)-2); % fast poles desiredPoles = [p1 p2 extraPoles];