MATLAB Modeling PMDC Motor & Mechanical System

AI Thread Summary
The discussion centers on modeling a Permanent Magnet DC (PMDC) motor and its associated mechanical system using differential equations in MATLAB. The user is attempting to graph the time histories of three differential equations related to the system's dynamics. The equations describe the angular displacement, angular velocity, and current of the motor, with specific parameters defined globally. A key issue arises when substituting a variable for a constant voltage in the equations, leading to problems in graphing the results. However, the user ultimately resolves the issue independently, indicating a breakthrough in understanding the MATLAB implementation.
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.
 

Similar threads

Back
Top