Transfer Function
English translation
Learning objectives
Even with the same coefficients, responses depend on the interconnection and cancellation conditions. Practice predicting behavior from coefficients.
Execution conditions
Find poles and zeros using python-control's ctl.poles and ctl.zeros.
If the module is missing, run %pip install control==0.10.2 in a Colab or Jupyter code cell.
From coefficients to poles and zeros
num: coefficient array of the numerator polynomial.den: coefficient array of the denominator polynomial.- Array order: highest power first.
Starting conditions
- A: , .
- B: , .
- C: , .
Procedure
- Run A as the baseline example. Write the numerator and denominator as polynomials, and calculate using
np.rootsandctl.poles/ctl.zeros. - Apply the same procedure to B and C. Distinguish numerator and denominator degrees from the number of finite zeros, and record both real and imaginary parts of complex roots.
- Plot the poles and zeros of all three models on one complex plane. Use × for poles and ○ for zeros, with a different color for each model.
Results to retain
- 1 table with one row per model and 1 pole–zero map.
- Example level for A: H(s)=2/(5s+1), pole -0.2, no finite zeros. Complete B and C yourself.
- Briefly explain the relationship between coefficients and roots.
import numpy as np
import matplotlib.pyplot as plt
import control as ctl
s = ctl.tf('s')
models = {'A':([2],[5,1]), 'B':([1,2],[1,3,2]), 'C':([1,1],[1,2,5])}
H_A = ctl.tf(*models['A'])
print(H_A, ctl.poles(H_A), ctl.zeros(H_A), ctl.dcgain(H_A))
# TODO: Complete the tables and complex-plane plots for B, C.
Record results and self-check
Model:
H(s):
Pole:
Finite zeros:
DC Gain:
Points to check
- Do the roots calculated directly from the coefficients match the library results, apart from their order?
- When the denominator's constant term is not 0, does DC gain equal the ratio of constant terms?
Comparing series, parallel, and feedback connections
Starting conditions
, . Use negative unity feedback for .
Procedure
- Derive expressions for , , and .
- Use
ctl.series,ctl.parallel,ctl.feedbackto build the same models, and compare with the directly derived expressions at ω=[0.1,1,10] rad/s. - Plot the unit-step response of T over s. Distinguish the poles at the origin of Hs and Hp from the meaning of DC gain.
Results to retain
- 1 coefficient table for the 3 interconnections and 1 step plot of T.
- Record the error as the absolute difference between complex responses at the same frequency.
import numpy as np
import matplotlib.pyplot as plt
import control as ctl
s = ctl.tf('s')
H1=ctl.tf([2],[1,0]); H2=ctl.tf([3],[4,1])
Hs=ctl.series(H1,H2); Hp=ctl.parallel(H1,H2); T=ctl.feedback(Hs,1)
print(Hs, Hp, T)
t=np.linspace(0,50,2501)
t,y=ctl.step_response(T,t)
plt.plot(t,y); plt.xlabel('Time [s]'); plt.ylabel('Output'); plt.grid()
# TODO: Compare frequency responses with the directly calculated models.
Record results and self-check
Interconnection:
Derived numerator:
Derived denominator:
Maximum frequency-response error:
Points to check
- Is the response difference between the two representations at most 1e-6? Did you divide all coefficients by the same value to normalize the denominator's leading coefficient to 1 before comparing?
- Does the step plot show time [s], output, and a sufficiently long recording interval?
Cancellation and small coefficient changes
Starting conditions
Create model D by changing B's numerator from [1,2] to [1,2.1]. Both models have denominator [1,3,2].
Procedure
- Record the original pole–zero maps of B and D alongside the models simplified with minreal.
- Plot the difference between the two responses to the same unit-step input over s.
- Distinguish exact from near cancellation, and explain why the model before cancellation should also be retained.
Results to retain
- 1 model-order table and a response-difference plot.
- A brief explanation of the tolerance used to identify cancellation and its interpretation.
import numpy as np
import matplotlib.pyplot as plt
import control as ctl
s = ctl.tf('s')
B=ctl.tf([1,2],[1,3,2]); D=ctl.tf([1,2.1],[1,3,2])
print(ctl.minreal(B),ctl.minreal(D))
# TODO: Examine both responses and their difference on the same time axis.
Record results and self-check
Model:
Original order:
Order after simplification:
Maximum response difference:
Points to check
- Did you avoid assuming that D has the same canceled model as B?
- Did you distinguish model representation order from actual response differences?