Skip to main content

Module functions

Module functions 

Source
Expand description

Auto-generated module

🤖 Generated with SplitRS

Functions§

bode_data
Bode plot data: returns (frequencies, magnitude_dB, phase_deg).
cohen_coon_pid
Cohen-Coon PID tuning from plant parameters.
controllability_matrix
Compute the controllability matrix [B, AB, A^2B, …].
discretize_tustin
Discretize a transfer function using Tustin (bilinear) transform.
discretize_zoh
Discretize a state-space model using Zero-Order Hold (ZOH).
h2_norm
Compute the H2 norm of a stable SISO system via numerical integration.
h_infinity_norm_bound
Approximate the H-infinity norm (peak of |H(jw)|) over given frequencies.
impulse_response
Impulse response of a transfer function.
is_controllable
Check if the system is controllable (rank of controllability matrix == n).
is_observable
Check if the system is observable (rank of observability matrix == n).
lag_compensator
Design a lag compensator for steady-state error reduction.
lead_compensator
Design a lead compensator for a desired phase margin boost at crossover frequency.
logspace_omega
Generate logarithmically spaced frequencies.
lqr_cost
Compute the LQR cost: J = x’Qx + u’Ru.
lyapunov_stable_2x2
Check Lyapunov stability for a 2x2 system by examining eigenvalues of A.
mat_add
Add two n-by-m matrices.
mat_eye
Identity matrix of size n.
mat_inv_small
Invert a small matrix (up to 3x3) using cofactors.
mat_mul
Multiply n-by-k matrix A by k-by-m matrix B, returning n-by-m.
mat_scale
Scale matrix by scalar.
mat_sub
Subtract two n-by-m matrices: a - b.
mat_transpose
Transpose n-by-m matrix to m-by-n.
matrix_rank
Estimate the rank of an n-by-m matrix via column pivoting.
nyquist_data
Nyquist plot data: returns (real_parts, imag_parts).
nyquist_encirclements
Check Nyquist stability: counts encirclements of -1+0j.
observability_matrix
Compute the observability matrix [C; CA; CA^2; …].
observer_gain_ackermann
Observer gain via Ackermann’s formula (works for 1-D systems).
pid_reset
Reset PID controller state.
pid_update
Update PID controller and return the control output.
pole_placement_check
Check if all poles have negative real part (stable).
poly_add
Add two polynomials (may differ in length).
poly_deriv
Derivative of polynomial coefficients [a_n, ..., a_0].
poly_eval
Evaluate polynomial at real x using Horner’s method.
poly_eval_complex
Evaluate a polynomial with coefficients [a_n, a_{n-1}, ..., a_0] at complex z.
poly_mul
Multiply two polynomials (convolution of coefficient arrays).
poly_roots
Find polynomial roots using Durand-Kerner method.
root_locus
Compute root locus: poles of 1 + K*H(s) for varying gain K.
root_locus_breakpoints
Find the break-away/break-in points on the real axis for root locus.
routh_hurwitz_stable
Routh-Hurwitz stability test.
solve_lyapunov_1x1
Solve continuous Lyapunov equation AP + PA’ + Q = 0 for 1x1 system.
ss_output
Compute output: y = Cx + Du.
ss_simulate
Simulate state-space model over time steps, returning state history.
ss_step
Advance state by one Euler step: x_{k+1} = x_k + dt*(Ax_k + Bu_k).
stability_margins
Compute gain margin and phase margin from Bode data.
step_response
Step response of a transfer function (via state-space simulation).
ziegler_nichols_pid
Ziegler-Nichols PID tuning from ultimate gain and period.