Project - Speed Control of a Direct Current (DC) motor
clc;
clear all;
% This file contains the design parameters to model DC Motor
J=0.01; % Moment of inertia of the rotor in kg-m^2
b=0.1; % Motor Viscous friction constant in N-m-s.
Km=0.01; % Back EMF constant in v/rad/s
Kt=0.01; % Motor Torque Constant in N-m/amp
Ra=1.0; % Resistance of the armature circuit in ohms
La=0.5; % Inductance of the armature circuit in henries
%%Design of PID Controller
% System matrix A & B
A=[-b/J Kt/J; -Km/La -Ra/La];
B=[0 ; 1/La];
% Placement of Poles
fn=1;
wn=2*pi*fn;
zeta=0.5;
p1=-zeta*wn+wn*sqrt(zeta^2-1);
p2=-zeta*wn-wn*sqrt(zeta^2-1);
P=[p1;p2]
K=place(A,B,P);
Kp = K(1)
Kd = K(2)
%END
-----------------------------------------------------------------------------------------------------