compute_controllability_matrix

Function compute_controllability_matrix 

Source
pub fn compute_controllability_matrix(
    mat_a: &DMatrix<f64>,
    mat_b: &DMatrix<f64>,
) -> Result<DMatrix<f64>, &'static str>
Expand description

Computes the controllability matrix for a given state-space representation.

§Arguments

  • mat_a - The state matrix (A) of the system.
  • mat_b - The input matrix (B) of the system.

§Returns

  • Result<na::DMatrix<f64>, &'static str> - The controllability matrix if successful, or an error message if the A matrix is not square.

§Errors

This function will return an error if the A matrix is not square.

§Panics

This function does not panic.

§Examples

use control_sys::analysis;

let mat_a = nalgebra::dmatrix![1.0, -2.0;
                               2.0, 1.0];
let mat_b = nalgebra::dmatrix![1.0;
                               2.0];
match analysis::compute_controllability_matrix(&mat_a, &mat_b) {
    Ok(result) => { println!("Controllability matrix is {}", result); },
    Err(msg) => { println!("{}", msg)}
}