6
$\begingroup$

I'm trying to display the output response of a transfer function in Mathematica with and without a compensator. The problem is very strange: while the transfer function compensate is showing well, the other is not.

The plot seems incomplete and no matter what PlotRange I set, the graph always stays incomplete at the same point.

Here is a screenshot:

enter image description here

Anybody have an idea of what is wrong? I'm pretty sure the math itself is okay, because I get the second transfer function from the first. But when I want to compare the two responses graph, the first always stays incomplete.

$\endgroup$
0

3 Answers 3

8
$\begingroup$

o1 isn't always real - it has a small imaginary component. For example o1 /. t -> 4 gives 0.995493 - 5.18448*10^-7 I. What you could do is Chop the output response:

o1 = Chop @ OutputResponse[tfm, UnitStep[t], t];

This gives you a nice smooth graph.

But on the other hand if you look at the unchopped version o1 /. t-> 8 you get 831840. + 332820. I. Not a small imaginary component at all - so maybe chopping it wasn't a good idea.

You could also try an exact equation by replacing 43.35 with 4335/100. This gives real results, but goes haywire when t > 5.

Unfortunately I know nothing about transfer functions to say which might be right.

$\endgroup$
1
  • $\begingroup$ That's it, you are totally right! The problem was the rounded decimal. In a Transfer Function Model, the smaller alteration of an equation could turn your system «out of control» (this is Control Theory). So, using the most correct expression –not rounded decimals– is the right way. Or in this case, just using Chop is ok enough. Thanks a lot! :D $\endgroup$
    – Linnk
    Commented Apr 27, 2012 at 0:35
3
$\begingroup$

another solution is to just specify a time interval in OutputResponse .. represented in a "One-liner" below..

Plot[OutputResponse[#, 1, {t, 10}] & 
/@ (TransferFunctionModel[#, s] & 
/@ {43.5/( s^3 + 10 s^2 + 24 s + 43.35), 43.5/( s^3 + 10 s^2 + 71.45 s + 142.35)}),
{t, 0, 10},  Evaluated -> True]
$\endgroup$
0
$\begingroup$

you can add the Abs[o2] Abs[o1] and try it works.

p2 = Plot[Abs[o2], {t, 0, 10}, PlotRange -> {0, 1.25}]
p1 = Plot[Abs[o1], {t, 0, 10}, PlotRange -> {0, 1.25}]
$\endgroup$
1
  • $\begingroup$ That's not so good, when your equation is not well expressed (like with my rounded decimals), 'cause the result it's not look-like for stable system and someone might make a mistake with the response's interpretation. Chopping it's a better (but still wrong) idea 'cause the approximation it's much close to an output response in control system. But it's nice to know all this alternatives (especially when you're a newbie on Mathematica hehe)… thanks a lot for you answer! $\endgroup$
    – Linnk
    Commented Apr 27, 2012 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.