Automatic Control EEE Tutorial Exercise IV k A second order system is given by G() s =. as + bs + c k'. Write the transfer function as: G() s =. s + ζω ns + ωn () G s = as k = + bs + c s + k / a b s a + c a, hence c b k' = k / a, ω b n =, ζω a n = ζ = a a a c. For k = and ζ =., ω = rad s and define a transfer function and use the command damp to find the damping factor and natural frequency. >> kp=; z=.; wn=; >> num=kp; den=[ *z*wn wn^]; >> g=tf(num,den) Transfer function: -------------- s^ + s + >> [z, wn]=damp(g) z =.. wn =.. 3. Based on the previous answer predict the behaviour of the system for a (unit) step input. Since the damping factor is positive and less than I expect a stable but initially oscillatory behaviour. The frequency of these oscillations is ω d = ωn ζ =. =.33rad / s. The overshoot is going to be:
>> mp=exp(-(z/sqrt(-z^))*pi) mp =.63 The peak time is: >> wd=wn*sqrt(-z^); tp=pi/wd tp =.7 And finally the settling time: >> ts=3/(z*wn) ts =.. Find the step response of that system using Matlab AND Simulink and hence crosscheck your previous answer. Also plot the system s error. >> step(g).. System: g Peak amplitude:.6 Overshoot (%): 6.3 At time (sec):.79 System: g Settling :.6.3..... Check the properties of the settling time and notice the discrepancy!????
. Use the command step as [y,t]=step(sys), where sys is the transfer function of the system given in the previous question. Using these two vectors find the overshoot and peak time. kp=; z=.; wn=; num=kp; den=[ *z*wn wn^]; g=tf(num,den); [y,t]=step(g); yss=y(); mp=max(y) overshoot=*(mp-yss)/yss k=find(y==max(y)); tp=t(k) mp =.6 overshoot = 6.3 tp =.788 6. Using Matlab find the exact value of the steady state error using Matlab AND Simulink. >> [y,t]=step(g); >> yss=y(); err_ss=-yss err_ss =.999 See also Simulink model, once you run the simulation type: >> plot(error_scope(:,),error_scope(:,))
.99.98.97.96.9... 3 >> error_scope(,) ans =.96 7. Assume a system with k = and ω = rad s. Use an m-file to calculate and hence plot the pole location in the s-plane for [.,.] ζ (use a step size of.). kp=; wn=; cnt=; for z=.:.:.; den=[ *z*wn wn^]; r(cnt,:)=roots(den); cnt=cnt+; hold on plot(real(r(:,)),imag(r(:,)),'b.') plot(real(r(:,)),imag(r(:,)),'g.') - - - -
8. Assume a system with ζ =. and ω = rad s. Use an m-file to calculate and hence plot the pole location in the s-plane for [., ] k (use a step size of.). As kp is not in the CE no change will be seen in the pole location. 9. Assume a system with k = and ζ =.. Use an m-file to calculate and hence plot the pole location in the s-plane for [.,] ω (use a step size of ). n kp=; z=.; cnt=; for wn=.::; den=[ *z*wn wn^]; r(cnt,:)=roots(den); cnt=cnt+; hold on plot(real(r(:,)),imag(r(:,)),'b.') plot(real(r(:,)),imag(r(:,)),'g.') - - - - -3 - -. Find the unit step response and discuss the results (in connection to your answer given in the previous question) for: a. k =., k = and k = (keep ζ =., ω = rad s ) num=.; num=; num3=; z=., wn=; den=[ *z*wn wn^]; g=tf(num,den); g=tf(num,den); g3=tf(num3,den); subplot(3,,); step(g)
subplot(3,,); step(g) subplot(3,,3); step(g3) x -3 3......3........3..... b. ζ =., ζ =, ζ =. (keep k = and ω = rad s ) num=; wn=; z=., z=; z3=.; den=[ *z*wn wn^]; den=[ *z*wn wn^]; den3=[ *z3*wn wn^]; g=tf(num,den); g=tf(num,den); g3=tf(num,den3); subplot(3,,); step(g)
subplot(3,,); step(g) subplot(3,,3); step(g3).6.. 6 8..3..... 3..3..... 3 c. ω =.rad / s, ω = rad / s, ω = rad s (keep ζ =., k = ) n n num=; z=.; wn=., wn=; wn3=; den=[ *z*wn wn^]; den=[ *z*wn wn^]; den3=[ *z*wn3 wn3^]; g=tf(num,den); g=tf(num,den); g3=tf(num,den3);
subplot(3,,); step(g) subplot(3,,); step(g) subplot(3,,3); step(g3) 3 x - 3..... 6 x -..... Comments on these responses during the lectures!. Using the specific formula plot the overshoot versus the damping factor. cnt=; for z=.:.: mp(cnt)=exp(-(z/sqrt(-z^))*pi); cnt=cnt+;
plot(.:.:,mp,'.').8.6.....6.8. Using the specific formula plot the overshoot versus the natural frequency. The overshoot is not a function of the natural frequency! 3. Using the specific formula plot the peak time versus the damping factor for wn=rad/s. cnt=; wn=; for z=.:.: wd=wn*sqrt(-z^) tp(cnt)=pi/wd; cnt=cnt+; plot(.:.:,tp,'.') 3...6.8
. Using the specific formula plot the peak time versus the natural frequency for z=.rad/s. 3 3 6 8. Using the specific formula plot the settling time (% and % in the same graph) versus the natural frequency for z=.rad/s: cnt=; z=.; for wn=.:.: ts(cnt)=3/z/wn; ts(cnt)=/z/wn; cnt=cnt+; plot(.:.:,ts,'r.'), hold on plot(.:.:,ts,'b.') 8 6 6 8 6. Using the specific formula plot the settling time (% and % in the same graph) versus the damping factor for wn=rad/s:
cnt=; wn=; for z=.:.: ts(cnt)=3/z/wn; ts(cnt)=/z/wn; cnt=cnt+; plot(.:.:,ts,'r.'), hold on plot(.:.:,ts,'b.') 8 7 6 3...3...6.7.8.9