You are on page 1of 4

MATLAB IMPLEMENTATION

Constraints
Following are the constraints of this project

Sr. No. Constraints Magnitude

1. Mass of the ball 0.0027 kg

2. Radius of the ball 0.02 m

3. Gravitational Acceleration 9.81 m/s2

4. Length of the beam 0.3 m

5. Ball’s moment of inertia 9.99 × 10-6 kgm/s2

Transfer function of ball and beam system

Code for transfer function


m = 0.0027;
R = 0.02;
g = -9.8;
L = 0.3;
J = 9.99e-6;
s = tf('s');
P_ball = -m*g/1/(J/R^2+m)/s^2

Result
P_ball =

0.9561

------

s^2

Step response

MATLAB Representation (Proportional-integral-derivative Controller)

Code
m = 0.0027;
R = 0.02;
g = -9.8;
L = 0.3;
J = 9.99e-6;
num = -(m*g/1/(J/R^2+m)/s^2);
denum = {1 0 0};
G = tf(num,denum);
kp = 200;
ki = 0.5;
kd = 1200;
C = pid(kp,ki,kd);
sysC = feedback(C*G,1);
step(sysC)

Result

RiseTime: 0.0019

TransientTime: 0.0034

SettlingTime: 0.0034

SettlingMin: 0.9001

SettlingMax: 0.9995

Overshoot: 0

Undershoot: 0

Peak: 0.9995
PeakTime: 0.0064

You might also like