function V = voltagefun(t,x)

theta = x(2);
dtheta = x(3);
Vnom = 12;

% Constant nominal voltage:
V = Vnom;

% % Or, voltage that oscillates in time
% freq = 2; 
% V = 12*square(freq*t*2*pi);
 
% % Or, proportional derivative (PD) control of voltage
% thetades = 4*pi;
% Kp = 4000;
% Kd = 10;
% V = Kp*(thetades-theta) + Kd*(0-dtheta);

% % Apply voltage limits
% V = max(min(V,Vnom),-Vnom);
