% fpendulum.m
% ODE/Vector Field Calculation for Pendulum Model
% x(1) = theta
% x(2) = dtheta/dt
function f = fpendulum(t,x)
global m l g B T

f = zeros(2,1); % initialize as column vector
f(1) = x(2);
f(2) = (T + m*g*l*sin(x(1)) - B*x(2))/(m*l^2);