>>> s,k=symbols('s k')>>> gain=k# Let unknwon gain be k>>> a=[-3]# Zero at -3 in S plane>>> b=[-1,-2-I,-2+I]# Poles at -1, (-2, j) and (-2, -j) in S plane>>> tf=TransferFunction.from_zpk(a,b,gain,s)>>> pprint(tf) k*(s + 3)-------------------------------(s + 1)*(s + 2 - I)*(s + 2 + I)>>> gain=tf.dc_gain()>>> print(gain)3*k*(2 - I)*(2 + I)/25>>> K=solve(gain-20,k)[0]# Solve for k>>> tf=tf.subs({k:K})# Reconstruct the TransferFunction using .subs()>>> pprint(tf.expand()) 100*s ----- + 100 3------------------- 3 2s + 5*s + 9*s + 5
Subpart 2
>>> tf.is_stable()# Expect True, since poles lie in the left half of S planeTrue
Subpart 3
>>> fromsympyimportinverse_laplace_transform>>> t=symbols('t',positive=True)>>> # Convert from S to T domain for impulse response>>> tf=tf.to_expr()>>> Impulse_Response=inverse_laplace_transform(tf,s,t)>>> pprint(Impulse_Response) -t -2*t 100*e 100*e *cos(t) ------- - ---------------- 3 3
Subpart 4
>>> # Apply the Initial Value Theorem on Equation of S domain>>> # limit(y(t), t, 0) = limit(s*Y(S), s, oo)>>> limit(s*tf,s,oo)0
>>> f=m*diff(y(t),t,t)+c*diff(y(t),t)+k*y(t)-u(t)>>> F=laplace_transform(f,t,s,noconds=True)>>> F=laplace_correspondence(F,{u:U,y:Y})>>> F=laplace_initial_conds(F,t,{y:[0,0]})>>> t=(solve(F,Y(s))[0])/U(s)# To construct Transfer Function from Y(s) and U(s)>>> tf=TransferFunction.from_rational_expression(t,s)>>> pprint(tf) 1-------------- 2c*s + k + m*s
The system matrix (Transfer Function Matrix) in the Laplace domain (g(t) → G(s)).
The number of input and output signals in the system.
Poles and Zeros of the system elements (individual Transfer Functions in Transfer Function Matrix) in the Laplace domain (Note: The actual poles and zeros of a MIMO system are NOT the poles and zeros of the individual elements of the transfer function matrix). Also, visualise the poles and zeros of the individual transfer function corresponding to the 1st input and 1st output of the G(s) matrix.
Plot the unit step response of the individual Transfer Function corresponding to the 1st input and 1st output of the G(s) matrix.
Analyse the Bode magnitude and phase plot of the Transfer Function corresponding to 1st input and 2nd output of the G(s) matrix.
A system is designed by arranging P(s) and C(s) in a series configuration (Values of P(s) and C(s) are provided below). Compute the equivalent system matrix, when the order of blocks is reversed (i.e. C(s) then P(s)).
Also, find the equivalent closed-loop system(or the ratio v/u from the block diagram given below) for the system (negative-feedback loop) having C(s) as the controller and P(s) as plant(Refer to the block diagram given below).