Giter Site home page Giter Site logo

lti's Introduction

LTI

[WIP] A header only C++17 library for linear time invariant system based on Eigen3

Usage

Just include the lti.hpp in your project.

#include <lti.hpp>

int main()
{
    int nx = 2, nu = 2, ny = 2;
    Eigen::MatrixXd A(nx, nx);
    Eigen::MatrixXd B(nx, nu);
    Eigen::MatrixXd C(ny, nx);
    Eigen::MatrixXd D(ny, nu);
    A.setRandom();
    B.setRandom();
    C.setIdentity();
    D.setZero();

    //----------------------------------------
    // Continuous LTI state space representation
    // der(x) = Ax + Bu;
    //      y = Cx + Du;
    //----------------------------------------
    lti::css sys_c(A, B, C, D);

    //----------------------------------------
    // Discrete LTI state space representation
    // x(k+1) = A(k) + Bu(k);
    //   y(k) = Cx(k) + D(k);
    //----------------------------------------
    double dt = 0.001;
    lti::dss sys_d(A, B, C, D, dt);

    //---------------------------------
    // Create a transfer function
    //          s + 2
    // Y/U = -----------
    //       s^2 + 2s + 3
    //---------------------------------
    Eigen::ArrayXd num(2);
    Eigen::ArrayXd den(3);
    num << 1, 2;
    den << 1, 2, 3;
    lti::tf sys3(num, den);

    using namespace lti;
    lti::tf sys4 = (s + 1) / (s * s + 2 * s + 1);

    std::cout << sys1 << "\n";
    std::cout << sys2 << "\n";
    std::cout << sys3 << "\n";
    std::cout << sys4 << "\n";
}

lti's People

Contributors

hyumo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.