0% found this document useful (0 votes)
27 views

Automatic Control System Matlab Program

Research Paper

Uploaded by

Ikshore Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
27 views

Automatic Control System Matlab Program

Research Paper

Uploaded by

Ikshore Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
Matlab Programs 01: Obtain the unit step response of a second order system with zeta = 0.5 oy Examp! juand wn 6rad/S: a tr please note that peak time, settling time etc can be obtained on clicking on the response obtained yeta-05 %define zeta e % define wn in rad/sec. wine [wntwn] % obtain numerator of transfer function en [ 1 2izetatwn watwn] % obtain coefficients of % denominator of transfer function % display label transfer function is % create transfer function % and display it % obtain the unit step response Step Response ‘qransfer function is’ Getf (num, den) step (G) 570 1/ Automatic Control System , tion of a system is a. kample 02: The closed loop transfer functi ; of the “%s (s°2+98+19) / (534 75°2+14s+8). Determine the unit step resp ‘%system, Gd % clear graph num= [1919 9} % define coefficients of numerator of % transfer function den = [17148] % define coefficients of denominator of % transfer function G= tf (num, den) % obtain transfer function subplot (2,1,1) Step (G) % obtain step response tile (response obtained by using CSTB’)_% CSTD= control system toolbox t=0:.01: 6; % obtain the step response as er expression derived C= (11/3) *exp (4) ~ (6/2) “exp (-2"t) (1/6) *exp (-4"t) ; subplot (2, 1, 2) plot (t, C) title (’ response obtained using the derived expression’) _ Response obtained by using CSTB gi 2 a Eos 0 3 Time (sec) : c a Response obtained using the derived expression Matlab Programs // 571 03: The open loop transfer function ofa servo system with unity given by G(s) = 10/(s#2) (s+5). Determine the damping ratio, qqundamped natural frequency of oscillation. What is the percentage overshoot of the response to a unit step input. cleat df num= [10 le % define the numerator of open loop tf genzconv (I 2] [1, 5] ) 5% define the denominator of open loop tf in % the factoted form Getf (num, den) % obtain open loop tf Tefeedback G1) % obtain the closed loop tf "V’) % extract the numerator and denominator goexamPl back is frum, dent]=tfdata (T, % of closed loop tf T wnesqrt (dent (3) % find wn ent (2) / (2*wn) % find zeta zeta Mp=100"exP (cpitzeta/sqrt (1-zeta*zeta)) % find Mp step (T) % generate step response and view its characterstics step Response 572 1 Automatic Control System “Example 0: For a unity feedback control system the forward path function is, given by G(s) = 20/s (s+2) (s2+2s+20). Determine the steady state error of “othe system, when inputs are (i) 5, (ii) 5t and (ii) 3t82/2 clear dle numg=[20] ; “define numerator of G(s) deng= conv ( conv ( {1 0}, 1 2)),[1.220]); % define denominator of G(s) ; G=tf (numg, deng) ; Kp=degain (G) % find kp ‘steady state error for 5 is’ ess=5/ 1+ kp) % find steady state error for 5 = conv ([1 0], [20] ; % define denominator of G(s) ; =deng ; % define denominator of sG(s) SG= tf (numsg, densg) ; % find sGi(s) kvadegain (sG) % find sG (s) KVadecgain (8G) % find kv “ steady state for St is’ ess=5 / kv % find, steady state error for 5t nums2g=conv ( [10], numsg); _% define numerator of s42G (s) dens2g=deng ; % define denominator of s“2G(s) s2G=tf (nums2g, dens2g) ; % find sA2G (s) ka= degain (s2G) % find ka “ steady state for 3t * 2/t is’ ess=3/ka inf ws? dy sta w te error for 5 is state for 3t*2/t is Waming: Divide by 2e70- » ning off MATLAB:divideByZero" to suppress this warning.) tv orc: \MATLAB6pS\work \probé.m at line 23 ess= Inf 574 1” Automatic ‘Control System %o Example 05: % sketch the polar plot of % Gls) = 20s/ (s+1) (5410) ange W=(10:.1:5], [6:1000}];% define the frequency = frequency range nelength (w) ; % number of data points in islin ; st0)); Gjw= (2056 (9/4 GeGewtiy + Oe M() =abs (G jw); % obtain the magni Ph (i) =angle (G_jw); % obtain the phase end Polar (Ph, M) % polar plot ey ode P plot for w8oe 0/8 (1+0-18) (14.0018) Ge) a 2 (100) # a art ol, oe ‘jaen 3] setts den); eae (@) ae hase, Wl =bode(G) (1,01); [1 001) the transfer function Bode Diagram 250 & at 8 “Magnitude (ab) 8 10° 10% 10 3 ce Frequency (rad/sec) 107 10° 107 ction 4 Sample 07: Sketch the Bode Plot for transfer fun % Gl8) =1000/(140. 1s) (1400018) Aum=1000 ; den=cony ((0.1 1], L001 1) ; G=tf (num, den) margin (G) Bode Diagram oe = 18.2 deg (at 3.08e+003 Gin neo) Pr Peete T fh ‘Magnitude (dB) Phase (deg) Matlab Programs // ample 08: ‘Sketch the Bode Plot for the transfer function se | =1000/s (140.15) (140.0018) % 1000; mr onv ({1 0}, conv ( {0.1 1}, |.001 1}, : geri (our) angi (C) grid on Bode Diagram Gm = 0.0864 dB (at100 rad/sec), Prm= 0.0584 deg (at 995 rad/sec) 100 50 e Magnitude (4B) Phase (deg) 2 > 10 a 10 -270 o 10 ” .d/sec) Frequency (ra bas an 578 // Automatic Control System °oExample 09: tion Yo Example 09 Sketch the Bode Plot for the transfer funct % G(s) =e*-0.35/s (14s) den=cony ( [1 O}, 111}; Inputadelay’ , delay) ; ade (G,2) ; margin (GG) ° grid on Bode Diagram Gm = 0.0864 dB (at100 rad/sec), Pm= 0.0584 deg (at 99.5 rad /sec) 100 Magnitude (4B) & Phase (deg) 180 10 ao 10 Ww w Frequency (rad/sec) a _ penceeeeeiann 10: A unity feedback control system is characterized by open loop transfer ogExomP ion oes + 13)/816 + 3) (647) op fur 4G) of values of k for the system ot be stable the range a fidn 3100] + tength (K) 2K (n) *[1 13]; denzconv ( [1 0}, conv ({1.3],[171)); Getf (num den) ; Tefeedback (G, 1) ; =pole (T) ; reteal (poles) ; if max (1) >=0 poles k=K(n) break end end 580 // Automatic Control System ‘“%oExample 11: Sketch the root locus for %G(s) = K(S+1) /s%2 (543.6) clf cle clear num= [1 1]; den=conv ({ 100], [1.3.6]; f (num, den) ; locus (G) ; Imaginary Acts Root Locus AS al ~05 Real Axis 0 mp «I Gls) His) = 60/(S+1) (542) (45) etch the Nyquist plot for the system ue Monecors (UE 1], conv ({ 12}, {15})); GHetf (ums den) ; ayauist (CHD 5 Nyquist Diagram Imaginary Axis oI 0 T 2 3 4 5 6 ie 12: Consider the transfer function Matlab Programs // 581 “oExample 13 : The system equations are: 0 roaor-[ ap «(io % y=1 0] x % find the transfer function A=[01;-2-3); b=[0; 1]; c= [10]; d=[0] ; {num, den] = ss2tf (A, b, ¢, d) Printsys (num, den, ‘s’) % Example 14: A single input single output system is given by sl 0 6 1 Yexdot =| 2 0 Ix(t)+} 1 fu O 0 3 0 %y=[10 2x % Test for controllability and observability -1 90;0-20;00-3] ; M=ctrb (A, B) rank_of_M=rank (M) system_order=length (A) N=(obsv (A, C) )’ Rank_of_N=randk (N)

You might also like