You are on page 1of 7

Use MATLAB to generate the step response of the following systems.

Find the rise time and percent overshoot (if applicable). 20 a. H (s ) = (s + 2) 10 b. H (s ) = 2 s + 10s + 100
% find the step response of the following two systems % first-order system num = [20]; den = [1 2]; tt = 0:0.01:2; figure; subplot(2,1,1); step(num,den,tt); title('Step Response of First-Order System') % second-order system num = [10]; den = [1 10 100]; tt = 0:0.01:2; subplot(2,1,2); step(num,den,tt); title('Step Response of Second-Order System') axis([0 2 0 0.12]);

The rise time and the percent overshoot can be found from the following plots.
Step Response of First-Order System 10 8 Amplitude 6 4 2 0

0.2

0.4

0.6

0.8

1 Time (sec)

1.2

1.4

1.6

1.8

Step Response of Second-Order System 0.12 0.1 0.08 Amplitude 0.06 0.04 0.02 0 0 0.2 0.4 0.6 0.8 1 Time (sec) 1.2 1.4 1.6 1.8 2

Alternatively, we can use more sophisticated MATLAB code to find out the rise times and percent overshoot for us. Type help function_name to learn more about MATLAB functions.
% first-order system num = [20]; den = [1 2]; tt = 0:0.01:2; figure; subplot(2,1,1); step(num,den,tt); [y] = step(num,den,tt); title('Step Response of First-Order System') [I1,J1] = find(y >= 0.1*10); [I2,J2] = find(y >= 0.9*10); tr = tt(I2(1))-tt(I1(1)) % second-order system num = [10]; den = [1 10 100]; tt = 0:0.01:2; subplot(2,1,2); step(num,den,tt); [y] = step(num,den,tt); title('Step Response of Second-Order System') axis([0 2 0 0.12]); [I,J] = find(y >= 0.1); tr = tt(I(1)) y_max = max(y); y_ss = y(end); percent_overshoot = ((y_max - y_ss)/y_ss)*100

Step Response of First-Order System 10 8 Amplitude 6 4 2 0

tr = 1.1 second

0.2

0.4

0.6

0.8

1 Time (sec)

1.2

1.4

1.6

1.8

Step Response of Second-Order System 0.12 0.1 0.08 Amplitude 0.06 0.04 0.02 0 0 0.2 0.4 0.6 0.8 1 Time (sec) 1.2 1.4 1.6 1.8 2

tr = 0.25 second Percent Overshoot = 16.2943%

You might also like