State-Space Modeling and Controllability Analysis in MATLAB
Engineers and researchers working on MIMO aerospace and robotics feedback control often need a repeatable workflow for state-space modeling and controllability analysis in matlab. Instead of building ad-hoc scripts from scratch, MATLAB provides tested built-in functions such as sys = ss(A, B, C, D); Co = ctrb(A, B) to structure inputs, run calculations, and validate outputs quickly.
This guide walks through the core theory, parameter choices, and a complete runnable MATLAB implementation you can adapt for coursework, lab experiments, or simulation benchmarks.
How the workflow operates
Before calling sys = ss(A, B, C, D); Co = ctrb(A, B), organize your input vectors or system matrices with consistent units and sampling intervals. Clean preprocessing prevents numerical instability, dimension mismatches, and silent scaling errors when moving from small test vectors to larger datasets.
Key parameters and tuning considerations
Choosing appropriate tolerances, step sizes, or sample rates directly controls accuracy and execution speed. Keep the baseline values below as a starting point and verify convergence on a small synthetic signal before testing on measured data.
| Setting | Recommended starting point | Impact on output |
|---|---|---|
| Primary call | sys = ss(A, B, C, D); Co = ctrb(A, B) |
Executes the core control systems computation |
| Input precision | Double-precision column vectors | Avoids dimension mismatch and rounding drift |
| Validation check | Plot residual and time/frequency response | Confirms physical bounds before downstream use |
Runnable MATLAB example
Copy the script below into a new MATLAB live script or .m file to run a complete end-to-end test and inspect the generated figure.
%% State-Space Modeling and Controllability Analysis in MATLAB
clear; clc; close all;
% Define second-order plant transfer function
num = [1];
den = [1, 1.4, 1.0];
sys = tf(num, den);
% Reference syntax: sys = ss(A, B, C, D); Co = ctrb(A, B)
[A, B, C, D] = tf2ss(num, den);
Q = diag([10, 1]);
R = 0.1;
K = lqr(A, B, Q, R);
sys_cl = ss(A - B*K, B, C, D);
t = 0:0.01:8;
[y_open, ~] = step(sys, t);
[y_closed, ~] = step(sys_cl, t);
figure('Color', 'w');
plot(t, y_open, 'r--', 'LineWidth', 1.5); hold on;
plot(t, y_closed, 'b-', 'LineWidth', 2.0);
grid on; xlabel('Time [s]'); ylabel('Amplitude');
title('State-Space Modeling and Controllability Analysis in MATLAB');
legend('Open-Loop', 'Closed-Loop');
Practical applications and next steps
You can extend this pattern directly into Simulink blocks, hardware-in-the-loop (HIL) benchmarks, or automated batch scripts for MIMO aerospace and robotics feedback control. If you are debugging convergence issues, custom Simscape blocks, or tight project deadlines, explore our control system assignment help or request custom MATLAB and Simulink project support.