Skip to content

unexpected behaviour of feedback combined with step_response #1102

Closed

Description

@johnlataire

Hi,

Here is unexpected behaviour when I create an LTI system with ct.zpk, put it in unity feedback using ct.feedback, and compute the ct.step_response of the resulting feedback system. For the tested system, the result should be stable, but it is not.

Here's the code:

import control as ct
import numpy as np
import matplotlib.pyplot as plt

# the system
G = ct.zpk([],[0,-5,-10],1)
print(G)

K = 500
ct.root_locus_plot(G,initial_gain = 500)

This generates the root locus, indicating the result for the gain 500, which shows that the system is stable in closed loop, for this gain value.

Image

Here's the code where unexpected behaviour occurs:

# put the system in unity feedback, with gain of 500
Gc = ct.feedback(G,K)
print(Gc)

# plot the step response
stepresp = ct.step_response(Gc)
stepresp.plot()

# check the pole locations
pzmap = ct.pole_zero_map(Gc)
print(pzmap.poles)

The response is clearly unstable, while the poles have negative real parts (i.e. stable)!

Image

On the other hand, creating the feedback system directly with ct.tf (as was computed higher up, so theoretically the same feedback system), results in a stable step response.

# create the feed
Gcexpl = ct.tf([],[1,15,50,500])
print(Gcexpl)

steprespexpl = ct.step_response(Gcexpl)
steprespexpl.plot()

This step response is stable, as expected.

Image

This indicates that the system generated by ct.feedback is not valid.

Any clue?
Thanks in advance!

Activity

  1. murrayrm commented on Jan 19, 2025

    @murrayrm
    Member

    This same issue came up in #1062 and was fixed in #1064. The issue is that timebase in zpk was not being set correctly and so it was getting interpreted as a discrete time system.

    If you don't want to check out the latest main branch, you can fix the problem by changing the zpk call to

    G = ct.zpk([], [0, -5, -10], 1, dt=0)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions