Last chance! 50% off unlimited learning
Sale ends in
ramp
obtains the ramp response of the linear system:
ramp(sys, t, input)
rampplot(sys, t, input)
LTI system of transfer-function, state-space and zero-pole classes
Time vector. If not provided, it is automatically set.
For calls to ramp
, input
is a number specifying an input for a MIMO state-space system. If the system has
3 inputs, then input
would be set to 1, set to 2 and then to 3 to obtain the ramp
response from input 1, 2, and 3 to the outputs. For single input systems, input
is always
set to 1.
For calls to rampplot
, input
is a vector or range for a MIMO state-space system. For example, input <- 1:3
for a system with 3-inputs
A list is returned by calling ramp
containing:
t
Time vector
x
Individual response of each x variable
y
Response of the system
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 rampplot
ramp
produces the ramp response of linear systems using lsim
rampplot
produces the ramp response as a plot against time.
These functions can handle both SISO and MIMO (state-space) models.
#' Other possible calls using ramp
and rampplot
are:
ramp(sys)
ranp(sys, t)
rampplot(sys)
rampplot(sys, t)
# NOT RUN {
res <- ramp(tf(1, c(1,2,1)))
res$y
res$t
ramp(tf(1, c(1,2,1)), seq(0, 6, 0.1))
rampplot(tf(1, c(1,2,1)))
rampplot(tf(1, c(1,2,1)), seq(0, 6, 0.1))
# }
# NOT RUN {
State-space MIMO systems
# }
# NOT RUN {
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))
res1 <- ramp(ss(A,B,C,D), input = 1)
res2 <- ramp(ss(A,B,C,D), input = 2)
res1$y # has two rows, i.e. for two outputs
res2$y # has two rows, i.e. for two outputs
rampplot(ss(A,B,C,D), input = 1:2) # OR
rampplot(ss(A,B,C,D), input = 1:ncol(D))
rampplot(ss(A,B,C,D), seq(0,3,0.01), 1:2)
# }
Run the code above in your browser using DataLab