MATLAB Code - Kinematic Analysis

%Linear motion
%taken measurements
h = 1;
theta = 0:1:360;
beta = 90;

%equation
s = h/2*(1-cos(pi*theta/beta));
v = pi/beta*(h/2)*sin(pi*theta/beta);
a = pi^2/beta^2*(h/2)*cos(pi*theta/beta);

%plot
figure
plot(theta,s)

xlabel('theta');
ylabel('displacement (cm)')
axis([0 , 360 , 0 , 1])
title('position analysis')

figure
plot(theta,v)

xlabel('theta')
ylabel('velocity (cm/s)')
axis([0 , 360 , -0.02 0.02 ])
title('velocity analysis')
figure
plot(theta,a)

xlabel('theta')
ylabel('acceleration (cm/s^2)')
title('acceleration analysis')


% Rotary motion
theta_r = 180*sind(theta/2);
figure
plot(theta,theta_r)
title('theta vs angular position')
xlabel('theta')
ylabel('rotary angle')
axis([0 360 0 190])