3.8 Related Rates

This page presents MATLAB and Mathematica assisted solutions to exercise 38 from $\S$3.8.

Octave / MATLAB

Mathematica


Octave / MATLAB

Please refer to the text for a statement of the problem and a simple picture (p.163).

>> syms t theta(t) x(t) % t is time, theta is viewing angle, x is car position >> d = 132; % distance from camera to track >> v = 264; % speed of car >> pos1 = 0; % x value when car is right in front of camera >> pos2 = 0.5*v; % x value a half second later >> eqn = ( tan(theta(t))==x(t)/d ); % equation that relates the variables >> angle1 = atan( pos1/d ); % theta value at first moment of interest >> angle2 = atan( pos2/d ); % theta value at second moment of interest >> derived_eqn = diff( eqn, t ); % relationship on rates >> derived_eqn = subs( derived_eqn, diff(x(t), t), v ) % simplify with given info derived_eqn = (tan(theta(t))^2 + 1)*diff(theta(t), t) == 2 >> dthetadt = 2/(tan(theta(t))^2+1); % time derivative of theta >> subs( dthetadt, theta(t), [angle1 angle2]) ans = [2, 1]

The row vector at the end gives ${\displaystyle \frac{d\theta}{dt}}$ in radians/sec at the moment when car passes directly in front of the camera and a half second later.


Mathematica

Please refer to the text for a statement of the problem and a simple picture (p.163).

The warning produced by the Solve[] command should be considered. The $\tan{}$ function is $\pi$ periodic, so take a moment and check that the given answers are correct in the context of the problem and not off by $\pi$.

The units for the answers are radians/sec.