# OutputResponse in V9 vs V10

Bug introduced in 10.0.1 and persisting through 10.2 or later

I have same code that works in version 9.0.1, but not in version 10.0.1.0 (according to @Sektor, it works in 10.0.0.0, too).

in = UnitStep[t - 20] - UnitStep[t - 75];
tMax = 100;
time = {t, 0, tMax};

thisWc = TransferFunctionModel[{{{0.9 (1 + 19 s)}}, 19 s}, s]

Wp23 = TransferFunctionModel[{{{E^((-2) s)}}, (1 + 2 s)^5}, s]

out = OutputResponse[
SystemsModelFeedbackConnect[
SystemsModelSeriesConnect[thisWc, Wp23]], in, time]


One can approximate the TF in v10 with (thanks to @Nasser):

Wp23Approx = SystemsModelDelayApproximate[Wp23]

outApprox =
OutputResponse[
SystemsModelFeedbackConnect[
SystemsModelSeriesConnect[thisWc, Wp23Approx]], in, time]


Then the Error changes from

NestList::intnm: Non-negative machine-sized integer expected at position 3 in NestList[#1/. ControlRecastDEquationsDumpxx$_[t+Optional[Pattern[<<2>>]]]:>ControlRecastDEquationsDumpxx$[t+ControlRecastDEquationsDumpnn0$+1]&,ControlRecastDEquationsDumpy$615011[t]->ControlRecastDEquationsDumpstVar$6154[t]+ControlRecastDEquationsDumpcst$6156 Subscript[\[FormalU], 1][t],2.]. >> ....


to

NDSolve::ndsz: At t == 20.00000000000057, step size is effectively zero; singularity or stiff system suspected. >>


Surprisingly in v9 (and 10.0.0.0) both ways give the same result:

Edit: I'm using Win7 64bit

• I get the same error-free output executing this code @ 9.0.1.0 and @ 10.0.0.0. Try starting a clean kernel. Feb 5 '15 at 11:01
• @Sektor Unfortunately, evaluating this code on a new (empty) notebook with new started kernel, I still get the errors. I'm using v10.0.1.0
– Phab
Feb 5 '15 at 11:42
• What is your OS ? We should wait for others to confirm before filing a bug report. Feb 5 '15 at 11:52
• I'm working with Mma 10.0.1.0 and Windows 7 (64bit)
– Phab
Feb 5 '15 at 12:02
• Doesn't work in 10.0.2 under Windows. I vote for "bug." Feb 5 '15 at 13:48

You can get output if you first approximate your system. You have a delayed control system there due to the E^(-2) in the numerator of the wp23 transfer function. So use this below. In addition, asking for Minimal state model allows you to solve for this specific input you have

ClearAll[t, s];
in = 2 UnitStep[t - 20] - UnitStep[t - 500];
tMax = 100;
time = {t, 0, tMax};
wp23 = TransferFunctionModel[{{{E^((-2) s)}}, (1 + 2 s)^5}, s];
wp23 = SystemsModelDelayApproximate[wp23];
thisWcA = TransferFunctionModel[{{{0.8908858730832925 (1 + 19.096 s)}}, 19.096 s}, s];
tf = SystemsModelSeriesConnect[thisWcA, wp23];
tf = SystemsModelFeedbackConnect[tf];
ss = MinimalStateSpaceModel@StateSpaceModel@tf;
out = First@OutputResponse[ss, in, time];
Plot[out /. t -> i, {i, 0, tMax}, PlotRange -> All]


• @Phab as I said, with your specific input, the delayed unit step, the error is not related to the invalid TF. It is due to system being stiff with this specific input. The error now is At t == 20.00000000000057, step size is effectively zero; singularity or stiff system suspected. >>` So this is a separate issue, not related to original error about invalid TF. There can be other work around this now. But I did it pursue this, since I do not think it is related to your original error. Feb 5 '15 at 12:46