3

I understand what OutputResponse is doing in the first two examples below.

sys=TransferFunctionModel[{{{1+z}},0.1-0.667*z+z^2},z,SamplingPeriod->1];
u1=Join[{-1},ConstantArray[0,17]];
ListPlot[OutputResponse[sys, u1]]
(* result is not displayed *)

Second example:

u2=Join[ConstantArray[0,8],{1},ConstantArray[0,9]];
ListPlot[OutputResponse[sys, u2]]
(* result is not displayed *)

Next I see that OutputResponse[sys, {u1}] gives the exact same result OutputResponse[sys, {u1,u2}].

response1=OutputResponse[sys,{u1}];
response12=OutputResponse[sys,{u1,u2}];
response1===response12
(* True *)

The last line of the OutputResponse usage message says,
OutputResponse[sys, {u1, ..., um} ] gives the output response for multiple inputs ui.

So why are response1 and response12 above exactly the same? Also, please explain a simple example that uses this feature of OutputResponse where the result is affected by both u1 and u2.

Ted Ersek
  • 7,124
  • 19
  • 41

1 Answers1

3

I am no expert in Mathematica's control systems, but I think the reason is that your system is single input single output, and Mathematica is simply ignoring additional inputs in the list. Hence when you give input as {u1,u2,u3}, it is just using u1 each time.

sys=TransferFunctionModel[{{{1+z}},0.1-0.667*z+z^2},z,SamplingPeriod->1];
ss = StateSpaceModel[sys]

Mathematica graphics

It might be easier to see this for a continuous time system. Here is an single input single output system

sys1 = TransferFunctionModel[{{1/(s^2 + s)}}, s]
ss = MinimalStateSpaceModel[StateSpaceModel[sys1]]

Mathematica graphics

Now lets ask for the output response for some input

 OutputResponse[sys1, {Sin[t]}, t]

Mathematica graphics

Now let do as you did and give it multiple inputs

 OutputResponse[sys1, {Sin[t], Cos[t], t}, t]

Mathematica graphics

Same output. Because the system is single input, it used only first input in the list, which is Sin[t] only.

Also, please explain a simple example that uses this feature of OutputResponse where the result is affected by both u1 and u2.

You would need a 2 input system. Here is an example

sys2 = TransferFunctionModel[{{2/(1 + s), s/(s - 1)}}, s]
ss = MinimalStateSpaceModel[StateSpaceModel[sys2]]

Mathematica graphics

Now

 OutputResponse[sys2, {Sin[t]}, t]

Mathematica graphics

And

 OutputResponse[sys2, {Sin[t], Cos[t]}, t]

Mathematica graphics

Now it used the second input Cos[t] because the system supports 2 inputs, and the output now is different from when one input was given.

Nasser
  • 143,286
  • 11
  • 154
  • 359