initial obtains the time response of the linear system:
[REMOVE_ME]dx/dt=Ax+Bu[REMOVEME2]
[REMOVE_ME]y=Cx+Du[REMOVEME2]
to an initial condition.
initial(sys, x0, t)initialplot(sys, x0, t)
Arguments
sys: LTI system of transfer-function, state-space and zero-pole classes
x0: initial conditions as a column vector. Should have as many rows as the rows of A. where x0 is not specified, random values are assigned
t: regularly spaced time vector. If not provided, it is automatically set.
For calls to initialplot, the same arguments are allowed
Returns
A list is returned by calling initial containing:
x Individual response of each x variable
y Response of the system
t Time vector
The matrix y has as many rows as there are outputs, and columns of the same size of length(t). The matrix X has as many rows as there are states. If the time vector is not specified, then the automatically set time vector is returned as t
A plot of y vs t is returned by calling initialplot
Description
initial obtains the time response of the linear system:
dx/dt=Ax+Buy=Cx+Du
to an initial condition.
Details
initial produces the time response of linear systems to initial conditions using lsim
initialplot produces the time response to initial conditions as a plot againts time.
The functions can handle both SISO and MIMO (state-space) models.
Other possible calls using initial and initialplot are:
initial(sys)
initial(sys, x0)
initialplot(sys)
initialplot(sys, x0)
Examples
res <- initial(tf(1, c(1,2,1)))res$y
res$t
A <- rbind(c(-2,-1), c(1,0)); B <- rbind(1,0);C <- cbind(0,1); D <- as.matrix(0);x0 <- matrix(c(0.51297,0.98127))initialplot(ss(A,B,C,D), x0)initialplot(tf(1, c(1,2,1)), t = seq(0,10,0.1))## Not run: State-space MIMO systems A <- rbind(c(0,1), c(-25,-4)); B <- rbind(c(1,1), c(0,1));C <- rbind(c(1,0), c(0,1)); D <- rbind(c(0,0), c(0,0))res <- initial(ss(A,B,C,D))res$y # has two rows, i.e. for two outputsinitialplot(ss(A,B,C,D))