You are on page 1of 6

Calculating the step response of a second-order system in Matlab

spring-mass-dashpot system Governing differential equation

+ Bx + kx = F (t ) mx
Perform Laplace transform

(ms 2 + Bs + k ) X ( s ) = F ( s )
Find transfer function G(s)

G (s) =

X (s) 1 = 2 F ( s ) ms + Bs + k

ME646

2/12/2009

Matlab command >> step


>> step calculates the unit step response of a linear system. Zero initial state is assumed in the state-space case. When invoked with no output arguments, this function plots the step response on the screen. MATLAB COMMANDS % identify the characteristics of the system % (values shown are for the underdamped case B2 < 4mk ) >> m = 1; (m is the mass of system) >> B = 10; %% (B is the damping value) >> k = 500; %% (k is the spring constant) % identify the numerator and the denominator of the system transfer % function >> num = [1]; (coefficients of the numerator of TF) >> den = [m B k]; (coefficients of the denominator of TF) % plot the unit step response >> step(num,den)

X (s) 1 G (s) = = 2 F ( s ) ms + Bs + k
ME646

2/12/2009

>> step %Output

(values shown are for the underdamped case B2 < 4mk ) >> m = 1 >> B = 10; %% >> k = 500; %%

ME646

2/12/2009

More Output Examples (try them yourself)

B (=0.1) << 4mk B (10,000) >> 4mk

Very under damped

Very over damped

Note that the time to each the expected value (2 x 103) is about the same for each of these cases.

ME646

2/12/2009

>> step %Works for first-order systems as well


MATLAB COMMANDS % identify the characteristics of the system % (values shown are for the underdamped case B2 < 4mk ) >> tau = 10; (tau is the time constant of the system) % function >> num = [1]; (coefficients of the numerator of TF) >> den = [tau 1]; (coefficients of the denominator of TF) % plot the unit step response >> step(num,den)

X ( s) 1 G ( s) = = F ( s) s + 1

ME646

2/12/2009

>> step %Output for first-order system

at t = tau (=10) output = 0.632 (for unit step) at t = 5tau (=50) output = 0.993 (for unit step)

ME646

2/12/2009

You might also like