How to plot $\dot{x}= Ax + Bu$ (x versus t, by matlab)

674 Views Asked by At

I am junior in control.

If $\dot{x} = Ax$ where $A$ is a $n\times n$ matrix and $x$ & $\dot{x}$ are $n\times 1$ vectors, by $x = \exp(At)$, we can draw $x$ versus $t$.


If $\dot{x} = Ax + Bu$, I want do the same thing, i.e., plot $x$ versus $t$, how should I do in Matlab?

  1. I do not want to integrate it.

  2. I know a function called 'lsim', however, it requires $A,B,C,D$. I only have $A$ & $B$.

How should I do?

1

There are 1 best solutions below

0
On BEST ANSWER

Your C=eye(n,n) and D=zeros(n,m), where m is the number of control inputs. That will give you y=x. As an example:

n=4;m=1;sys=ss(-eye(n,n)+0.33*rand(n,n),rand(n,m),eye(n,n),zeros(n,m)); u=@(t) sin(t)+cos(2*t);T=linspace(0,10,100);U=u(T);lsim(sys,U,T)