Page 179 - MATLAB an introduction with applications
P. 179
164 ——— MATLAB: An Introduction with Applications
peak_time =
1.5200
>> max_overshoot = ymax–1
max_overshoot =
0.5397
>> s=1001;while y(s)>0.98 & y(s)<1.02;s=s–1;end
>> settling_time=(s–1)*0.02
settling_time =
6.0200
Example E3.17: Obtain the unit-ramp response of the following closed-loop control system whose closed-
loop transfer function is given by
Cs = s + 12
()
3
2
()
Rs s + 5s + 8s + 12
Determine also the response of the system when the input is given by
r = e –0.7t
Solution:
>> % Unit-ramp response – lsim command
>> num=[0 0 1 12];
>> den=[1 5 8 12];
>> t=0:0.1:10;
>> r=t;
>> y =lsim(num,den,r,t);
>> plot(t,r, ‘–’, t,y, ‘o’)
>> grid
>> title(‘Unit-ramp response’)
>> xlabel(‘t Sec’)
>> ylabel(‘Output’)
>> text(3.0,6.5, ‘Unit-ramp input’)
>> text(6.2,4.5, ‘Output’)
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09