# Use OutputResponse in WM 12?

Posted 1 month ago
247 Views
|
3 Replies
|
4 Total Likes
|
 Hello I am trying to simulate a third order system using OutputResponse. Here are the commands I used for the simulation OutputResponse[TransferFunctionModel[k 1/(s (s + 1)^2 + k), s], UnitStep[t], t] Plot[% /. {k -> 1}, {t, 0, 100}] Almost a copy of the example shown in the help page for OutputResponse.Problems I have encountered are: a) WM takes a long time to output the answer. To be honest, I don't remember being that slow when using the same example in WM 11 (Unfortunately I have deleted the old version to give room to the new one). b) Rather intricate output - Again I don't recall WM 11 using RootSum in this particular problem. It is a third order polynomial. c) For k=1, the system is stable and the output of Plot is a response of an unstable system. It seems right up to t=20 but after WM 12 loses it completely. Numerical problems? My plan was to encapsulate the commands above in a manipulate loop for different values of k, but unfortunately I don't see how. I have tried different values of k and the output was not the one expected for any of them. Any help will be much appreciated. EdPs. I have tried alternatives such as defining a function resp[t,k] with = and := but to no avail.
3 Replies
Sort By:
Posted 1 month ago
 Hi Ed,I can confirm this. V11.3 is a bit faster, but both 11.3 and 12 produce the unstable response. It is clearly an error.RootLocusPlot confirms the system is stable with k=1: tfm = TransferFunctionModel[k 1/(s (s + 1)^2 + k), s]; RootLocusPlot[tfm, {k, .5, 1.5}, FeedbackType -> None, PoleZeroMarkers -> {None, Automatic, None, "ParameterValues" -> {1}}] Using Laplace transforms gives a believable result: stepResponse = InverseLaplaceTransform[k 1/(s (s + 1)^2 + k)/s, s, t]; Plot[stepResponse /. k -> 1, {t, 0, 50}, PlotRange -> All] And so does OutputResponse for the model with k = 1: out = OutputResponse[tfm /. k -> 1, UnitStep[t], {t, 0, 50}]; Plot[out, {t, 0, 50}, PlotRange -> All] I have reported three issues regarding Control Systems so far. Two have been confirmed as bugs. The third involved numerical instability in OutputResponse, for which I have had no reply.I suggest you report this to Tech Support.Kind regards,David
 If you use {k->1.}, Chop function is usually advised to applied to eliminate complex epsilons during numeric operation.
 Hi DavidMany thanks for the examples. Thanks to one of them, I wrote an animation that works in this case. Manipulate[ tfm = TransferFunctionModel[k 1/(s (s + 1)^2 + k), s]; out = OutputResponse[tfm /. k -> kval, UnitStep[t], {t, 0, 50}]; Plot[out, {t, 0, 50}, PlotRange -> All], {{kval, 1, "Gain"}, 0, 100, 1, Appearance -> "Labeled"}] I have been reporting Control Toolbox bugs since the time one had to buy it separately (Control System Professional version 2.1). I think this issue will be another one on my list.Kind RegardsEd