StateResponse[sys,u,{t,tmin,tmax}]
gives the numeric state response of the state-space model sys to input u for tmin≤t≤tmax.
StateResponse[sys,{u[0],u[1],…}]
gives the response of the discrete-time state-space model sys to the input sequence u[i].
StateResponse[sys,u,t]
gives the symbolic state response as a function of time t.
StateResponse[sys,{u1,…,um},…]
gives the state response for multiple inputs ui.
StateResponse[{sys,{x10,x20,…,xn0}},…, …]
gives the response with initial states xi0.
StateResponse
StateResponse[sys,u,{t,tmin,tmax}]
gives the numeric state response of the state-space model sys to input u for tmin≤t≤tmax.
StateResponse[sys,{u[0],u[1],…}]
gives the response of the discrete-time state-space model sys to the input sequence u[i].
StateResponse[sys,u,t]
gives the symbolic state response as a function of time t.
StateResponse[sys,{u1,…,um},…]
gives the state response for multiple inputs ui.
StateResponse[{sys,{x10,x20,…,xn0}},…, …]
gives the response with initial states xi0.
Details
- StateResponse solves the state differential or difference equations for the given input u.
- The state-space model sys can be a StateSpaceModel, a continuous-time AffineStateSpaceModel, or a continuous-time NonlinearStateSpaceModel.
- A linear StateSpaceModel sys can also be a descriptor and delay system.
- The initial states xi0 are taken to be the state operating values of sys unless specified.
- For descriptor systems, the initial states need to be consistent.
- For delay systems, the initial states include history and can be given as xi0[t] for t≤0.
Examples
open all close allBasic Examples (4)
The state response of a continuous-time system to a unit step input:
StateResponse[StateSpaceModel[{{{-1, 0}, {0, -3}}, {{1}, {2}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], UnitStep[t], t]Plot[Evaluate[%], {t, 0, 6}]The response of a discrete-time system with initial conditions {1,-1}:
sr = StateResponse[{StateSpaceModel[{{{0.9418, 0.2462}, {-0.2462, 0.3262}}, {{0.1958}, {-0.0291}}, {{2, 1}}, {{0}}},
SamplingPeriod -> 0.2, SystemsModelLabels -> None], {1, -1}}, Sin[t], {t, 0, 10}];ListStepPlot[sr, DataRange -> {0, 9 0.2}]The state-response of a system to a Dirac delta input:
StateResponse[StateSpaceModel[{{{0, 2}, {-1, -1}}, {{1, 1}, {1, 0}}, {{1, -2}}, {{0, 0}}},
SamplingPeriod -> None, SystemsModelLabels -> None], DiracDelta[t], t]Plot[Evaluate[%], {t, 0, 10}, PlotRange -> All]The step response of a time-delay system:
StateResponse[StateSpaceModel[{{{-1/2, 1}, {0, -2}}, {{0}, {SystemsModelDelay[4]}}, {{1, 0}}, {{0}}},
SamplingPeriod -> None, SystemsModelLabels -> None], {UnitStep[t]}, {t, 0, 15}];Plot[Evaluate[%], {t, 0, 15}]Scope (25)
Continuous-Time Systems (15)
The state response of a single-input system to a unit step:
StateResponse[{StateSpaceModel[{{{0, 1}, {-8, -6}}, {{0}, {1}}, {{1, 0}}, {{0}}}, SamplingPeriod -> None,
SystemsModelLabels -> None]}, UnitStep[t], t]The initial conditions are assumed to be zero:
% /. t -> 0The state response for a generic continuous-time system:
Expand[StateResponse[{StateSpaceModel[{{{a}}, {{b}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], Subscript[x, 0]}, u[t], t]]The response to a unit step input:
StateResponse[{StateSpaceModel[{{{a}}, {{b}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], Subscript[x, 0]}, UnitStep[t], t]The response of a descriptor StateSpaceModel:
Expand[StateResponse[{StateSpaceModel[{{{a}}, {{b}}, {{c}}, {{d}},
{{e}}}, SamplingPeriod -> None, SystemsModelLabels -> None], Subscript[x, 0]}, u[t], t]]The numeric response to a sinusoidal input:
StateResponse[StateSpaceModel[{{{-1, 0}, {0, -3}}, {{1}, {2}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], Sin[t], {t, 0, 15}]Plot[Evaluate[%], {t, 0, 15}]Specify {0.2,0.1} as the initial state values:
StateResponse[{StateSpaceModel[{{{0, 1}, {-8, -6}}, {{0}, {1}}, {{1, 0}}, {{0}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], {0.2, 0.1}}, UnitStep[t], t]% /. t -> 0The response of a two-input system to input signals {SquareWave[t],Sin[t]}:
Plot[Evaluate[StateResponse[StateSpaceModel[{{{-3, 3/2, -1}, {-2, 1, -2}, {-1, 3, -2}}, {{1, 0}, {1, -1}, {1, 1}},
{{1, 0, -1}}, {{0, 0}}}, SamplingPeriod -> None, SystemsModelLabels -> None], {SquareWave[t], Sin[t]}, {t, 0, 20}]], {t, 0, 20}]The state response of a three-input system to inputs {Sin[t],Cos[t],Cos[t]}:
Simplify[StateResponse[StateSpaceModel[{{{-6, 8, 0, 3}, {1, 0, 0, 3}, {-1, 1, -5, 0}, {-1, -5, 0, -10}},
{{1, 0, 0}, {0, 1, -1}, {1, 1, 0}, {0, 0, 1}}, {{-1, 2, 3, 4}}, {{0, 0, 0}}},
SamplingPeriod -> None, SystemsModelLabels -> None], {Sin[t], Cos[t], Cos[t]}, t]]Plot[Evaluate[%], {t, 0, 10}]If there are fewer input signals than inputs, the remaining inputs are assumed to be zero:
ssm = StateSpaceModel[{{{-6, 8, 0, 3}, {1, 0, 0, 3}, {-1, 1, -5, 0}, {-1, -5, 0, -10}},
{{1, 0, 0}, {0, 1, -1}, {1, 1, 0}, {0, 0, 1}}, {{-1, 2, 3, 5}}, {{0, 0, 0}}},
SamplingPeriod -> None, SystemsModelLabels -> None];StateResponse[ssm, {Sin[t]}, t] == StateResponse[ssm, {Sin[t], 0, 0}, t]If a scalar input signal is given for a multiple-input system, it is applied to each input in turn:
ssm = StateSpaceModel[{{{-1, 0}, {0, -3}}, {{1, 0, 0}, {0, 1, -1}}, {{1, 0}}, {{0, 0, 0}}},
SamplingPeriod -> None, SystemsModelLabels -> None];StateResponse[ssm, UnitStep[t], t] == (StateResponse[ssm, #, t]& /@ Permutations[{UnitStep[t], 0, 0}, {3}])StateResponse[…,{t,tmin,tmax}] gives the result in terms of interpolating function objects:
StateResponse[{StateSpaceModel[{{{0, 1}, {-8, -6}}, {{0}, {1}}, {{1, 0}}, {{0}}}, SamplingPeriod -> None,
SystemsModelLabels -> None]}, UnitStep[t], {t, 0, 4}]Plot[Evaluate[%], {t, 0, 4}]The step response of a singular descriptor system:
ssm = StateSpaceModel[{{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}, {0, 0, -1, -5/2}},
{{0}, {1}, {0}, {1}}, {{-1, -9/2, -39/2, -21/4}}, {{0}}, {{0, 1, 0, 0}, {0, 0, 0, 0},
{0, 0, 1, 0}, {0, 0, 0, 1}}}, SamplingPeriod -> None, SystemsModelLabels -> None];
StateResponse[ssm, {Sin[t] HeavisideTheta[t]}, {t, 0, 10}];Plot[Evaluate[%], {t, 0, 10}]The symbolic response for a singular descriptor system:
StateResponse[StateSpaceModel[{{{-1, 0}, {1, -1}}, {{1}, {1}}, {{1, 0}}, {{0}}, {{1, 1}, {0, 0}}},
SamplingPeriod -> None, SystemsModelLabels -> None], UnitStep[t], t]Plot[Evaluate[%], {t, 0, 10}]The state response of an AffineStateSpaceModel to a UnitStep input:
StateResponse[AffineStateSpaceModel[{{Subscript[x, 2], -Subscript[x, 1] -
Subscript[x, 1]^3*Subscript[x, 2]}, {{0}, {1}},
{Subscript[x, 1]}, {{0}}}, {Subscript[x, 1],
Subscript[x, 2]}, Automatic, {Automatic}, Automatic, SamplingPeriod -> None], UnitStep[t], {t, 0, 12}]Plot[Evaluate[%], {t, 0, 12}]The response from nonzero initial conditions:
StateResponse[AffineStateSpaceModel[{{Subscript[x, 2], -Subscript[x, 1] -
Subscript[x, 1]^3*Subscript[x, 2]}, {{0}, {1}},
{Subscript[x, 1]}, {{0}}}, {{Subscript[x, 1], 0.5},
{Subscript[x, 2], 0}}, Automatic, {Automatic}, Automatic, SamplingPeriod -> None], UnitStep[t], {t, 0, 12}];
Plot[Evaluate[%], {t, 0, 12}]The state response of a NonlinearStateSpaceModel to a sinusoidal input:
StateResponse[NonlinearStateSpaceModel[{{Subscript[x, 2],
(-u^2)*Subscript[x, 1]}, {Subscript[x, 1]}},
{{Subscript[x, 1], 1}, {Subscript[x, 2], 0}}, {u},
{Automatic}, Automatic, SamplingPeriod -> None], Sin[2 t], {t, 0, 25}]Plot[Evaluate[%], {t, 0, 25}]Discrete-Time Systems (10)
The state response of a single-input system to a unit step input:
τ = 1.5;
sr = StateResponse[StateSpaceModel[{{{0, 1}, {-1/20, 3/5}}, {{0}, {1}}, {{0, 1}}, {{0}}},
SamplingPeriod -> τ, SystemsModelLabels -> None], UnitStep[k], k]Plot the response for eight steps:
ListStepPlot[Table[sr, {k, 0, 8}], DataRange -> {0, 7 τ}]The response for a generic discrete-time system:
StateResponse[{StateSpaceModel[{{{a}}, {{b}}}, SamplingPeriod -> T,
SystemsModelLabels -> None], Subscript[x, 0]}, u[k], k]The response to a unit step sequence:
StateResponse[{StateSpaceModel[{{{a}}, {{b}}}, SamplingPeriod -> T,
SystemsModelLabels -> None], Subscript[x, 0]}, 1, k]The response for a symbolic descriptor system:
Simplify[StateResponse[{StateSpaceModel[{{{Subscript[a, 1], 0}, {0, Subscript[a, 2]}},
{{Subscript[b, 1]}, {Subscript[b, 2]}},
{{Subscript[c, 1], Subscript[c, 2]}}, {{0}},
{{Subscript[e, 1], 0}, {0, 0}}}, SamplingPeriod -> T,
SystemsModelLabels -> None], {Subscript[x, 1], Automatic}}, u[t], t]]The state response to a sampled sinusoid:
sr = StateResponse[StateSpaceModel[{{{0, 1}, {-0.5, 1.5}}, {{0}, {1}}, {{0, 1}}, {{0}}}, SamplingPeriod -> 1,
SystemsModelLabels -> None], Table[Sin[t], {t, 0, 15}]]Plot the response with a zero-order hold:
ListStepPlot[sr, DataRange -> {0, 14}]The state response of a two-input system to two randomly sampled inputs:
sr = StateResponse[StateSpaceModel[{{{0, 0, 1, 0}, {0, 0, 0, 1}, {-0.18, 0, 0.9, 0}, {0, -0.18, 0, 0.9}},
{{0, 0}, {0, 0}, {1, 0}, {0, 1}}, {{0.5, -0.3, 1, 1}}, {{0, 0}}}, SamplingPeriod -> 1,
SystemsModelLabels -> None], RandomReal[1, {2, 15}]]ListStepPlot[sr, DataRange -> {0, 14}]The response to a random input sequence:
sr = StateResponse[StateSpaceModel[{{{0, 1}, {-0.786, 1.783}}, {{0}, {1}}, {{0.177, -0.177}}, {{1}}},
SamplingPeriod -> 0.2, SystemsModelLabels -> None], RandomReal[1, 20]]ListStepPlot[sr, DataRange -> {0, 19 0.2}]A two-input state-space model:
ssm = StateSpaceModel[{{{0, 0, 1, 0}, {0, 0, 0, 1}, {-0.08, 0, 0.6, 0}, {0, -0.08, 0, 0.6}},
{{0, 0}, {0, 0}, {1, 0}, {0, 1}}, {{0.08, -0.2, 0.2, 1}}, {{1, 0}}}, SamplingPeriod -> 0.5,
SystemsModelLabels -> None];When only one input signal is given, the remaining inputs are set to zero:
StateResponse[ssm, {Table[TriangleWave[k], {k, 0, 3, 0.1}]}]The second and fourth states are not excited because the second input is zero:
Position[%, {(0.)..}]If a single-input sequence is given to a multi-input system, it is applied to each input in turn:
res = StateResponse[StateSpaceModel[{{{0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1},
{-0.36, 0, 0, 1.3, 0, 0}, {0, -0.36, 0, 0, 1.3, 0}, {0, 0, -0.36, 0, 0, 1.3}},
{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{0, -0.4, -0.4, 1, 1, 1}},
{{0, 0, 0}}}, SamplingPeriod -> 1, SystemsModelLabels -> None], Table[SawtoothWave[k], {k, 0, 3, 0.1}]];
Short[res, 20]Discrete-time time-delay systems accept a history for time steps before k0:
ssm = StateSpaceModel[{{{0.25, SystemsModelDelay[4]}, {0, -0.6}}, {{0}, {3}}, {{1, 0}}, {{0}}},
SamplingPeriod -> 0.5, SystemsModelLabels -> None];
x1history = {-4, -3, -2, -1, 0};
x2history = {1, 2, 3, 4, 5};sr = StateResponse[{ssm, {x1history, x2history}}, {UnitStep[t]}, {t, 0, 8}]ListStepPlot[sr, DataRange -> {0, 7 0.5}]```Generalizations & Extensions (3)
If the initial time is not specified, it is assumed to be zero:
StateResponse[StateSpaceModel[{{{-3}}, {{1}}, {{2}}, {{0}}}, SamplingPeriod -> None, SystemsModelLabels -> None], {UnitStep[t]}, {t, 2}];Plot[%, {t, 0, 2}]For a state-delay system, the initial states can include history:
StateResponse[{StateSpaceModel[{{{-1 + SystemsModelDelay[2]/2}}, {{0}}, {{1}}, {{0}}}, SamplingPeriod -> None,
SystemsModelLabels -> None], {-t}}, {0}, {t, 20}];
Plot[%, {t, 0, 20}]For discrete-time systems with delays, the initial states can be given as a sequence:
sr = StateResponse[{StateSpaceModel[{{{(-1 - SystemsModelDelay[3])/4}}, {{0}}, {{1}}, {{0}}}, SamplingPeriod -> 1,
SystemsModelLabels -> None], {{-3, -1, -3, -1}}}, {0}, {t, 0, 10}]ListStepPlot[sr, DataRange -> {0, 9}]Applications (4)
The model of a stabilized inverted pendulum on a moving cart has the cart displacement d and velocity v, together with the pendulum's angular position θ and velocity ω as the state variables:
ssm = StateSpaceModel[{{{0, 1, 0, 0}, {5.3572, 7.602, 56.6571, 18.102}, {0, 0, 0, 1},
{-5.3572, -7.602, -46.8571, -18.102}}, {{0}, {0.5}, {0}, {-0.5}}}, SamplingPeriod -> None,
SystemsModelLabels -> None];Compute the acceleration a of the cart and the angular acceleration α of the pendulum by differentiating the cart's velocity and the pendulum's angular velocity obtained using StateResponse:
{d, v, θ, ω} = StateResponse[{ssm, {0, 0, 0.05, 0}}, 0, {t, 4}];
a = D[v, t]
α = D[ω, t]Grid[{MapThread[Plot[#1, {t, 0, 3.5}, IconizedObject[«plotOpts»]]&, {{a, α}, {"cart acceleration", "pendulum torque"}}]}, Spacings -> 2]Analyze the response of the states to each control input for a multi-input system:
ssm = StateSpaceModel[{{{0, 0, -10, 0}, {0, 0, 0, 10}, {3.7, 0, -2, 0}, {0, -0.6, 0, -5}},
{{0, 0}, {0, 0}, {8.533, 0}, {0, 8.533}}, {{0.5, 0.5, 0, 0}, {-2.113, 2.113, 0.375, 0.375}},
{{0, 0}, {0, 0}}}, SamplingPeriod -> None, SystemsModelLabels -> None];Grid[MapIndexed[Plot[#, {t, 0, 5}, PlotRange -> All, PlotLabel -> "Input " <> ToString@First@#2 <> " -> " <> " State " <> ToString@Last@#2, ImageSize -> Small]&, StateResponse[ssm, UnitStep[t], t], {2}], Spacings -> 2]The state-space model of a production and inventory control system with desired production rate and sales rate as inputs and actual production rate and inventory level as states:
ssm = StateSpaceModel[{{{-1, -0.1875}, {1, 0}}, {{0.1875, 0}, {0, -1}}}, SamplingPeriod -> None,
SystemsModelLabels -> None];Determine the response for a given production rate and 10% jump in sales from the initial equilibrium condition:
resp = StateResponse[{ssm, {Subscript[x, 10], Subscript[u, 1]}}, {Subscript[u, 1], 1.1 Subscript[x, 10]}, t]//Expand//ChopPlot the response for specific initial conditions:
Grid[{Table[Plot[Evaluate[resp[[i]]] /. {Subscript[x, 10] -> 1, Subscript[u, 1] -> 6}, {t, 0, 50}, IconizedObject[«plotOpts»]], {i, 2}]}, Spacings -> 2]The Clohessy–Wiltshire equations model the relative motion between two satellites orbiting a central body:
sat = StateSpaceModel[{{{0, 1, 0, 0, 0, 0}, {3*n^2, 0, 0, 2*n, 0, 0},
{0, 0, 0, 1, 0, 0}, {0, -2*n, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, -n^2, 0}}, {{0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 1, 0}, {0, 0, 0},
{0, 0, 1}}, {{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}},
{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}}, SamplingPeriod -> None, SystemsModelLabels -> None];Use StateResponse to obtain the closed relative orbits from a particular set of launch conditions:
n = 0.001;Subscript[x, 0] = 1;Subscript[xd, 0] = 0.0005;
x = Map[StateResponse[{sat, {Subscript[x, 0], Subscript[xd, 0], (2Subscript[xd, 0]/n), -2n Subscript[x, 0], Sequence@@##}}, {0, 0, 0}, {t, 0, 5 (2Pi/n)}]&, {{-2 Subscript[x, 0], -2 Subscript[xd, 0]}, {2 Subscript[x, 0], 2 Subscript[xd, 0]}}];ParametricPlot3D[{x[[1, 1 ;; 5 ;; 2]], x[[2, 1 ;; 5 ;; 2]]}, {t, 0, 5 (2Pi/n)}, BoxRatios -> {1, 1, 1}, AxesLabel -> {"X", "Y", "Z"}]Properties & Relations (2)
The results of StateResponse and OutputResponse match for state output:
ssm = StateSpaceModel[{{{-1272, -818, -1636}, {-636, -414, -808}, {1282, 823, 1636}}, {{4}, {2}, {-4}}},
SamplingPeriod -> None, SystemsModelLabels -> None];
StateResponse[ssm, UnitStep[t], t] == OutputResponse[ssm, UnitStep[t], t]State output occurs when the output matrix is identity and the transmission matrix is zero:
MatrixForm /@ Normal[ssm][[3 ;; 4]]The natural response is determined by the poles of the system:
ssm = StateSpaceModel[{{{-2, 0, 0}, {0, -4, 0}, {0, 0, -5}}, {{1}, {-1}, {1}}, {{1, 0, 0}}, {{0}}},
SamplingPeriod -> None, SystemsModelLabels -> None];
StateResponse[{ssm, 1}, 0, t]It is invariant under any similarity transformation:
S = RandomReal[{-1, 1}, {3, 3}];StateResponse[{StateSpaceTransform[ssm, S], Inverse[S].{1, 1, 1}}, 0, t]//SimplifyS.%//Simplify//ChopPossible Issues (2)
Symbolic state responses do not support time delays:
dssm = StateSpaceModel[{{{-4 - SystemsModelDelay[3]}}, {{SystemsModelDelay[2]}}, {{1}}, {{0}}},
SamplingPeriod -> None, SystemsModelLabels -> None];
StateResponse[dssm, {Sin[t]}, t]StateResponse[dssm, {Sin[t]}, {t, 0, 10}];
Plot[%, {t, 0, 10}]For descriptor systems, solutions only exist when Det[λ e - a]≠0 for some λ:
ssm = StateSpaceModel[{{{-1, 0}, {2, 0}}, {{1}, {-1}}, {{1, 0}}, {{0}}, {{1, 0}, {0, 0}}},
SamplingPeriod -> None, SystemsModelLabels -> None];
StateResponse[ssm, {Sin[t]}, {t, 0, 10}]Related Guides
History
Introduced in 2010 (8.0) | Updated in 2012 (9.0) ▪ 2014 (10.0)
Text
Wolfram Research (2010), StateResponse, Wolfram Language function, https://reference.wolfram.com/language/ref/StateResponse.html (updated 2014).
CMS
Wolfram Language. 2010. "StateResponse." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/StateResponse.html.
APA
Wolfram Language. (2010). StateResponse. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StateResponse.html
BibTeX
@misc{reference.wolfram_2026_stateresponse, author="Wolfram Research", title="{StateResponse}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/StateResponse.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_stateresponse, organization={Wolfram Research}, title={StateResponse}, year={2014}, url={https://reference.wolfram.com/language/ref/StateResponse.html}, note=[Accessed: 12-June-2026]}