# DC Motor: Why are Step Responses Different for Transfer Function & State Space?

7 views (last 30 days)
Connor Grant on 11 Apr 2019
Answered: Arkadiy Turevskiy on 20 Jun 2019
Hello All,
I am new to MATLAB and control systems in general, so this is hopefully a nice and easy novice question.
I am trying to plot the step response of a DC motor using both the transfer function and state space model. But I am getting different answers for each of them. I was expecting them to be the same as your plotting the same response from the same system... can anyone explain why they're different? Or is there something wrong in my code?
DC Motor Being Modeled and Graphs of Step Responses are here:
MATLAB Code Here:
% Parameters
J=0.0113;
b=0.028;
L= 0.1;
R=0.45;
K=0.067;
% Transfer Function - Open Loop Response
s = tf('s');
P_motor = K/(s*((J*s+b)*(L*s+R)+K^2))
t = 0:0.001:0.2;
step(P_motor,t)
% State Space - Open Loop Response
A = [-b/J K/J
-K/L -R/L];
B = [0
1/L];
C = [1 0];
D = 0;
motor_ss = ss(A,B,C,D)
t = 0:0.001:0.2;
step(motor_ss,t)

Arkadiy Turevskiy on 20 Jun 2019
It looks like the transfer function is from voltage to angle, while state-space is from voltage to angular rate (speed).
If you remove the integrator from the transfer function, then the two are exactly the same.
P_motor = K/((J*s+b)*(L*s+R)+K^2)