[SciPy-user] Impulse/Step response troubles
Ryan Krauss
ryanlists@gmail....
Tue Apr 1 13:16:28 CDT 2008
I have seen the problem with repeated roots. I thought I reported it.
Your second case with a ramp response could be better handled with
signal.lsim using your original transfer function ([K],[1.0,8.0,K])
and u = t.
On Mon, Mar 31, 2008 at 11:50 AM, Kumar Appaiah <akumar@iitm.ac.in> wrote:
> Reply below quote.
>
>
> On Mon, Mar 31, 2008 at 08:52:57AM +0530, Kumar Appaiah wrote:
> > The question is to determine (plot) the step and ramp responses of
> > K / (s^2 + 8s + K) for K = 7, 16 and 80
> >
> > So, the following code is used, and I'll keep changing a line:
> > <code>
> > from scipy import *
> > from pylab import *
> >
> > K = 16.0 # should be redone with 7.0, 16.0 and 80.0
> >
> > r = signal.impulse(([K],[1.0,8.0,K]), T=r_[0:5:0.001])
> > plot(r[0], r[1], linewidth=2)
> > show()
> > </code>
> >
> > The above code plots the impulse response of the given function. Now,
> > on to the action:
> >
> > 1. Running the above code with K = 7.0 and K = 16.0 gives expected
> > results. However, running the code with K = 16.0 doesn't work; if K =
> > 16.0, the response should be 16 * t * exp(-4t) * u(t), which it
> > isn't. Changing K to 16 + or - .00000000001 fixes it. There surely is
> > some problem when the value of K is such that a double root is hit.
>
> Well, I've zeroed in on the issue. Running the code of
> signal.lti.impulse, we get here:
>
> s,v = linalg.eig(sys.A)
> vi = linalg.inv(v)
>
> Now, v is a matrix which has the eigen vectors, which are EQUAL in
> this case:
>
> print sys.A
> [[-0.9701425 -0.9701425 ]
> [ 0.24253563 0.24253563]]
>
> which is singular. However, the code goes on to invert this happily,
> resulting in a bad matrix and horrendous values. I would be surprised
> if nobody has encountered this yet (didn't find this on the Tickets).
>
> What would be the best way to handle repeated roots in the transfer
> function's denominator?
>
> Thanks.
>
>
>
> Kumar
> --
> Kumar Appaiah,
> 458, Jamuna Hostel,
> Indian Institute of Technology Madras,
> Chennai - 600 036
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-user
mailing list