% 
% File dc.m
% Matlab macro to simulate the responses
% of a DC motor with negligible inductance
%
global r k j
r=0.7;k=0.066;j=0.000057;
x0=[0];tmax=0.05;
[t,x]=ode45('dcf',[0,tmax],x0);
om=x(:,1);omrpm=om*30/pi;
cur=(40-k*om)/r;
figure(1);plot(t,omrpm);
xlabel('Time (s)');
ylabel('Speed (rpm)');
figure(2);plot(t,cur);
xlabel('Time (s)');
ylabel('Current (A)');


