Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question

migrated from math.stackexchange.com Apr 26 '12 at 23:57

This question came from our site for people studying math at any level and professionals in related fields.

3 Answers 3

up vote 8 down vote accepted

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.

share|improve this answer
    
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 –  Linnk Apr 27 '12 at 0:35

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]
share|improve this answer

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}]
share|improve this answer
    
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! –  Linnk Apr 27 '12 at 1:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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