% Chapter 4: Figure 4.23
%
%   Analysis of the open-loop speed control system.
%
Ra=1; Km=10; J=2; f=0.5; Kb=0.1;
num1=[1]; den1=[J f]; sys1=tf(num1,den1);
num2=[Km*Kb/Ra]; den2=[1]; sys2=tf(num2,den2);
sys_o=feedback(sys1,sys2);
%
% Change sign of transfer function since 
% disturbance has negative sign in the block diagram
%
sys_o=-sys_o
%
% Compute time response to a unit step disturbance   
%
[yo,T,xo]=step(sys_o);
plot(T,yo)
title('Open-loop Disturbance Step Response')
xlabel('Time (s)'), ylabel('\omega_o'), grid
%
% Steady-state error -> last value of output yo   
%
yo(length(T))

