function TxDot =  T3dxdt(t,x)
%% Threat is a 240 mm Rocket
% Compute Rocket xDot = [velocity; acceleration]'
g = 9.8066; % acceleration due to gravity
gravity = [0; 0; -g]; % gravity vector
diameter = 0.24; % missile diameter in m.
S = XX; % reference area in m^2
[acousticSpeed,rho] = getRho(x);
mach = norm(x(4:6))/acousticSpeed;

timeCurve = [XX]';  %seconds
thrustCurve = [XX]'; % Newtons

massCurve = [XX]'; % kg

machCurve = [XX];
dragCurve = [XX];

machCurveB = [XX];
dragCurveB = [XX];

if(t<=timeCurve(end-1))
    Cd = interp1(machCurveB,dragCurveB,mach,'linear','extrap');
else
    Cd = interp1(machCurve,dragCurve,mach,'linear','extrap');
end
mass = interp1(timeCurve,massCurve,t,'linear','extrap');
thrust = interp1(timeCurve,thrustCurve,t,'linear','extrap');
%Compute acceleration --------------------------------------------
dragAccel = -0.5*rho*Cd*S*x(4:6)*norm(x(4:6))/mass;% drag acceleration in m/sec^2
thrustAccel = thrust*x(4:6)/(mass*(norm(x(4:6))));
accel = dragAccel + thrustAccel + gravity; % total acceleration
TxDot = [x(4:6);accel];
end
