lqr_controller_design
Design an optimal Linear Quadratic Regulator (LQR) controller by computing state-feedback gain that minimizes a quadratic cost function, for given system and weighting matrices.
Instructions
Design Linear Quadratic Regulator (LQR) optimal controller.
Computes optimal state-feedback gain K that minimizes the cost function: J = integral(x'Qx + u'Ru) dt
Args: A_matrix: State matrix (n x n) - system dynamics B_matrix: Input matrix (n x m) - control influence Q_matrix: State weighting matrix (n x n) - penalizes state deviation R_matrix: Input weighting matrix (m x m) - penalizes control effort state_names: Optional names for states (for display) input_names: Optional names for control inputs (for display)
Returns: Formatted string with optimal gain matrix K, closed-loop eigenvalues, stability analysis, and controllability assessment.
Raises: No exceptions are raised directly; errors are returned as formatted strings or JSON error objects (e.g., when system is not controllable).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| A_matrix | Yes | ||
| B_matrix | Yes | ||
| Q_matrix | Yes | ||
| R_matrix | Yes | ||
| state_names | No | ||
| input_names | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |