# Behaviour of OutputResponse in ListLinePlot

Ok, I think this is not the best way to do this, so I'm open minded for every suggestion doing it in a better way.

The Question is why does ListLinePlot not plot all the data when it's inside Manipulate?

I created a dataset w/ and wo/ noise:

dataFunc[x_] := .5 Sin[x^2 + x]

dataRaw = Table[dataFunc[x], {x, 0, 2 π, .001}];
dataNoise =
Table[dataFunc[x] + RandomReal[{-1, 1}], {x, 0, 2 π, .001}];

Grid[{ListLinePlot /@ {dataRaw, dataNoise}}]
ListLinePlot[{dataNoise, dataRaw}]


I'm doing the built in low-pass filter with Manipulate

Manipulate[
ListLinePlot[{LowpassFilter[dataNoise, ω, n], dataRaw}],
{{ ω, .3}, .001, Pi, .001}, {{n, 100}, 1, 500, 1}]


Now I added my own low-pass filter:

discLowPass[T_, τ_] :=
ToDiscreteTimeModel[ TransferFunctionModel[ 1/(1 + T s), s], τ]


And here it is: Without the dataRaw it works

Manipulate[
ListLinePlot[OutputResponse[discLowPass[T, τ], dataNoise]],
{{T, .1}, .005, 25}, {{ τ, .005}, .001, .025}]


... but adding the signal without noise to the ListLinePlot it doesn't work anymore.
Why?

Manipulate[
ListLinePlot[{ OutputResponse[discLowPass[T, τ], dataNoise],
dataRaw}],
{{T, .1}, .005, 25}, {{ τ, .005}, .001, .025}]


It's just plotting the raw signal without the noise.

EDIT: Using Show it works for the OutputResponse, too.

Manipulate[
Show[{
ListLinePlot[OutputResponse[discLowPass[T, τ], dataNoise]],
ListLinePlot[dataRaw, PlotStyle -> Red]}],
{{T, .25}, .005, 5, .005}, {{ τ, .01}, .001, .025}]


-
What you are actually plotting in the end is ListLinePlot[dataRaw] – Öskå Apr 14 '14 at 12:05
@Öskå That's what I can see, yes, but what is with the Outputresponse? In the first case with LowpassFilter[] it works too, doesn't it? – Phab Apr 14 '14 at 12:12
The problem here is that Manipulate[ ListLinePlot[{OutputResponse[discLowPass[T, \[Tau]], dataNoise]}], {{T, .1}, .005, 25}, {{\[Tau], .005}, .001, .025}] is not being plotted for some reason. – Öskå Apr 14 '14 at 12:15
@Öskå ... and the question is why is it not plotted, while it is plotted when I take the built in LowpassFilter instead of the OutputResponse. – Phab Apr 14 '14 at 12:23

Like noted in the comments the problem is that

Manipulate[ListLinePlot[{OutputResponse[discLowPass[T, τ], dataNoise]}],
{{T, .1}, .005, 25}, {{τ, .005}, .001, .025}]


doesn't work while the following works:

Manipulate[ListLinePlot[OutputResponse[discLowPass[T, τ], dataNoise]],
{{T, .1}, .005, 25}, {{τ, .005}, .001, .025}]


By looking into OutputResponse[] you can see that it's built as follow:

OutputResponse[discLowPass[0.1, 0.5], dataNoise] // Short


{{-0.203869, -0.311799, -0.725601, <<6278>>, 0.765344, 1.17987, 0.143347}}

and that it's a {1, 6284} array.

Thus the following works:

Manipulate[ListLinePlot[{First@OutputResponse[discLowPass[T, τ], dataNoise], dataRaw}],
{{T, .1}, .005, 25}, {{τ, .005}, .001, .025}]


-