Modeling PMDC Motor & Mechanical System

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Quadruple Bypass
Messages
120
Reaction score
0
alright I've got to model a PMDC motor and a mechanical system attached to it

this is what i have so far for the equations part, which is where the problem is (im trying to graph the time histories of the 3 DE's)

function Xdot=project(t,X)
global R L km B J M b k r

V=10; % step function: 10 Volts

% State equations (1st order differential equations)
% X(1) = theta = angular displacement of pinion
% X(2) = theta dot = angular velocity of pinion
% X(3) = I = current
% X(4) = I dot

Xdot1= X(2);
Xdot2= (1/(J-M*r^2))*(-B*X(2)+km*X(3)+b*r^2*X(2)+k*r^2*X(1));
Xdot3= (V-R*X(3)-km*X(2))/L;

% The differential equations must be put in a column vector
Xdot=[Xdot1; Xdot2; Xdot3];

the bolded part is where the problem is. if i substitute it for a constant number, say 10, the graphs are good.

i suck at matlab, never understood it, I am confused, what do i do?
 
Physics news on Phys.org
never mind, my mind kicked in in the clutch and i got it.