


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Poles and Zeros Example 1 Determine the values of poles and zeros, pi and zi for the transfer function Syntax: TF2ZP Transfer function to zero-pole conversion. [Z,P,K] = TF2ZP(NUM,DEN) finds the zeros, poles, and gains:
num = [ 1 11 30 0]; den = [1 9 45 87 50]; [z,p,k] = tf2zp(num,den) z = 0
p =
k = 1 Example 2 Given z = - 6,-5,0, p = - 3 ±j4,-2,-4 and gain 1. Determine the transfer function. Syntax ZP2TF Zero-pole to transfer function conversion. [NUM,DEN] = ZP2TF(Z,P,K) forms the transfer function:
z = [-6; - 5; 0]; k = 1; j = sqrt(-1); p = [-3+4j; - 3 - 4j; - 2; - 4]; [num,den] = zp2tf(z,p,k) num = 0 1 11 30 0 den = 1 12 69 198 200 Partial Fraction Example 3 Syntax RESIDUE Partial-fraction expansion (residues). [R,P,K] = RESIDUE(B,A) finds the residues, poles and direct term of a partial fraction expansion of the ratio of two polynomials B(s)/A(s). num = [2 5 3 6]; den = [1 6 11 6]; [r,p,k] = residue(num,den) r =
p =
k = 2 Convert roots to polynomial Example 4 Determine polynomial s for function ( s +1)( s +2)( s +3) Syntax POLY Convert roots to polynomial. POLY(A), when A is an N by N matrix, is a row vector with N+1 elements which are the coefficients of the characteristic polynomial, DET(lambda*EYE(SIZE(A)) - A). POLY(V), when V is a vector, is a vector whose elements are the coefficients of the polynomial whose roots are the elements of V. For vectors, ROOTS and POLY are inverse functions of each other, up to ordering, scaling, and roundoff error.
c=[- 1 - 2 - 3]; poly(c) c =
Example 5 Find roots of polynomial s^3 + 6 s^2 +11 s + 6 Syntax ROOTS Find polynomial roots. ROOTS(C) computes the roots of the polynomial whose coefficients are the elements of the vector C. If C has N+1 components, the polynomial is C(1)X^N + ... + C(N)X + C(N+1).
c=[1 6 11 6] p=roots(c) c = 1 6 11 6 p =
load <namafile.dat> namafile is the variable save <fname.ext> X Y Z - ascii % 8-digit ASCII save <fname.ext> X Y Z - ascii - double % 16 - digit ASCII Time Response of a Control System Step response Example 6 C ( s ) R ( s ) =^
s^2 + 4 s + 25 ,^ u^ = unit step Syntax STEP Step response of LTI models. STEP(SYS) plots the step response of the LTI model SYS (created with either TF, ZPK, or SS).
num = [ 25]; den = [1 4 25]; step(num,den); step(num,den); grid title(‘Step response’) Example 7 Consider a system with transfer function as below C ( s ) R ( s ) =^ 3 s^3 + 25 s^2 + 72 s + 80 s^4 + 8 s^3 + 40 s^2 + 96 s + 80 num = [3 25 72 80]; den = [1 8 40 96 80]; step(num,den); grid; title(’Step Response Plot’) xlabel(t Sec); ylabel(’Output’) Root Locus Example 8 Plot the root locus for the system with feedforward transfer function as below Syntax RLOCUS(SYS) computes and plots the root locus of the single-input, single-output LTI model SYS. The root locus plot is used to analyze the negative feedback loop num = [1]; den = [1 1.1 10.3 5 0]; rlocus(num,den); grid Other MATLAB commands for root locus c=[1 6 11 6] >> p=roots(c) c = 1 6 11 6 p = - 3. - 2. - 1. 0000 Means: ( s +1)( s +2)( s +3) Save and load file The Syntax >>load <namafile.dat> namafile is the variable >>save <fname.ext> X Y Z - ascii % 8-digit ASCII >>save <fname.ext> X Y Z - ascii - double % 16 - digit ASCII Time Response of a Control System Step response Example 6 C ( s ) R ( s ) =^ s^2 + 4 s + 25 ,^ u^ = unit step Syntax STEP Step response of LTI models. STEP(SYS) plots the step response of the LTI model SYS (created with either TF, ZPK, or SS). >> num = [ 25]; >> den = [1 4 25]; >> step(num,den); >> step(num,den); grid >> title(‘Step response’) Example 7 Consider a system with transfer function as below C ( s ) R ( s ) =^ 3 s^3 + 25 s^2 + 72 s + 80 s^4 + 8 s^3 + 40 s^2 + 96 s + 80 >> num = [3 25 72 80]; >> den = [1 8 40 96 80]; >> step(num,den); grid; >> title(’Step Response Plot’) >> xlabel(t Sec); >> ylabel(’Output’) Root Locus Example 8 Plot the root locus for the system with feedforward transfer function as below Syntax RLOCUS(SYS) computes and plots the root locus of the single-input, single-output LTI model SYS. The root locus plot is used to analyze the negative feedback loop >> num = [1]; >> den = [1 1.1 10.3 5 0]; >> rlocus(num,den); grid Other MATLAB commands for root locus rlocus(num,den) p=roots(c) c = 1 6 11 6 p = - 3. - 2. - 1. 0000 Means: ( s +1)( s +2)( s +3) Save and load file The Syntax >>load <namafile.dat> namafile is the variable >>save <fname.ext> X Y Z - ascii % 8-digit ASCII >>save <fname.ext> X Y Z - ascii - double % 16 - digit ASCII Time Response of a Control System Step response Example 6 C ( s ) R ( s ) =^ s^2 + 4 s + 25 ,^ u^ = unit step Syntax STEP Step response of LTI models. STEP(SYS) plots the step response of the LTI model SYS (created with either TF, ZPK, or SS). >> num = [ 25]; >> den = [1 4 25]; >> step(num,den); >> step(num,den); grid >> title(‘Step response’) Example 7 Consider a system with transfer function as below C ( s ) R ( s ) =^ 3 s^3 + 25 s^2 + 72 s + 80 s^4 + 8 s^3 + 40 s^2 + 96 s + 80 >> num = [3 25 72 80]; >> den = [1 8 40 96 80]; >> step(num,den); grid; >> title(’Step Response Plot’) >> xlabel(t Sec); >> ylabel(’Output’) Root Locus Example 8 Plot the root locus for the system with feedforward transfer function as below Syntax RLOCUS(SYS) computes and plots the root locus of the single-input, single-output LTI model SYS. The root locus plot is used to analyze the negative feedback loop >> num = [1]; >> den = [1 1.1 10.3 5 0]; >> rlocus(num,den); grid Other MATLAB commands for root locus rlocus(num,den) rlocus(num,den,K) rlocus(A,B,C,D) rlocus(A,B,C,D,K) [r,K]=rlocus(num,den) [r,K]=rlocus(num,den,K) [r,K]=rlocus(A,B,C,D)
load <namafile.dat> namafile is the variable >>save <fname.ext> X Y Z - ascii % 8-digit ASCII >>save <fname.ext> X Y Z - ascii - double % 16 - digit ASCII Time Response of a Control System Step response Example 6 C ( s ) R ( s ) =^ s^2 + 4 s + 25 ,^ u^ = unit step Syntax STEP Step response of LTI models. STEP(SYS) plots the step response of the LTI model SYS (created with either TF, ZPK, or SS). >> num = [ 25]; >> den = [1 4 25]; >> step(num,den); >> step(num,den); grid >> title(‘Step response’) Example 7 Consider a system with transfer function as below C ( s ) R ( s ) =^ 3 s^3 + 25 s^2 + 72 s + 80 s^4 + 8 s^3 + 40 s^2 + 96 s + 80 >> num = [3 25 72 80]; >> den = [1 8 40 96 80]; >> step(num,den); grid; >> title(’Step Response Plot’) >> xlabel(t Sec); >> ylabel(’Output’) Root Locus Example 8 Plot the root locus for the system with feedforward transfer function as below Syntax RLOCUS(SYS) computes and plots the root locus of the single-input, single-output LTI model SYS. The root locus plot is used to analyze the negative feedback loop >> num = [1]; >> den = [1 1.1 10.3 5 0]; >> rlocus(num,den); grid Other MATLAB commands for root locus rlocus(num,den) rlocus(num,den,K) rlocus(A,B,C,D) rlocus(A,B,C,D,K) [r,K]=rlocus(num,den) [r,K]=rlocus(num,den,K) [r,K]=rlocus(A,B,C,D) [r,K]=rlocus(A,B,C,D,K) Plotting Polar Grids in the Root-Locus Diagram The command sgrid overlays lines of constant damping ratio (ξ = 0~1 with 0.1 increment) and circle of constant ωn on the root locus plot sgrid v=[-3 3 - 3 1]; axis(v);axis(
square) (Constant \zeta Lines and Constant \omega_n Circles) xlabel(Real Axis) ylabel(Imag Axis) If particular constant ξ lines (i.e ξ = 0. And ξ = 0.707 lines) and particular ωn circles (such as ωn = 0.5, 1, 2 circles, the command sgrid([0.5, 0.707], [0.5, 1, 2]) Example 9 Plot the root locus for the system
PD - Controller Consider a system with a controller as shown: And the feedforward transfer function is:
Using PD - controller, plot the root locus and determine the value of gains Kp and Kd to satisfy the transient response specified by the damping ratio ξ = 0.4. Gc ( s ) G ( s ) = Kd ( s + K Kp d
s ( s + 1 )( s + 2 )( s + 5 ) Choose Kp / Kd = 3,
c=[ 0 - 1 - 2 - 5]; den1=poly(c); num1=(1); rlocus(num1,den1),grid axis([-6 6 - 6 6]) num2=[1 3]; den2=den1; rlocus(num2,den2),grid axis([-6 6 - 6 6]) PID - Controller The feedforward transfer function is: Design specification - the first peak time, Tp is faster by 2/3 that of P - controller, maximum overshoot is 20% and without steady-state error For maximum overshoot M.O = 20%, ξ = 0.456, cos β = 0.456, β = 62. Using P - controller, plot the root locus and determine the value of gain Kp to satisfy the transient response specified by the damping ratio ξ = 0.456. c=[- 3 - 6 - 10]; den1=poly(c); num1=[1 - 8]; rlocus(num1,den1),grid axis ([-15 15 - 15 15]) rlocfind(num1,den1)
u ( t ) G ( s ) y ( t )
Gc ( s )
s s s G s^ s
1 2
Tp for P-controller = 0.297 s. The required specification: ω d for the compensated system: The value of the imaginary part for the dominant poles = 15.867. For ξ= 0.456, β = 62.9o. The value of the real part is : Thus the real part σ = - 8.13. The values of zeros for PD-controller: GPD = ( s + 55.9) PD - Controller The transfer function:
c=[- 3 - 6 - 10]; den1=poly(c); num1=[1 8]; rlocus(num1,den1),grid axis ([-15 15 - 15 15]) num2=poly([-55.9 - 8]; den2=den1; rlocus(num2,den2),grid axis ([-110 10 - 60 60]) PI - Controller The PI - Controller: PID-Controller
c=[- 3 - 6 - 10]; den1=poly(c); num1=[1 8]; rlocus(num1,den1),grid axis ([-15 15 - 15 15]) num2=poly([-55.9 - 8]; den2=den1; rlocus(num2,den2),grid axis ([-110 10 - 60 60]) num3=poly([-55.9 - 8 - 0.5]; den3=[den2 0]; rlocus(num3,den3),grid axis ([-110 10 - 60 60])
d (^) =tan 62. 9 o σ ω