compute_observability_matrix

Function compute_observability_matrix 

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

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

§Arguments

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

§Returns

  • Result<na::DMatrix<f64>, &'static str> - The observability 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_c = nalgebra::dmatrix![1.0, 2.0];

match analysis::compute_observability_matrix(&mat_a, &mat_c) {
    Ok(result) => { println!("Observability matrix is {}", result); },
    Err(msg) => { println!("{}", msg)}
}