It So\u4i'o(\ m = IO kg = O = 1C Nl F= ma ro 10 V- Tires'- * O , 0 -- I X -- F orce - a, = O+OwiOXsi) = = d),
It So\u4i'o(\
m = IO kg= O
= 1C Nl
F= ma ro 10
V-
Tires'- * O , 0 -- I
X --
Force
- a,
= O+OwiOXsi) =
= d),
371
3 ^-Q
*r\X
a*•-•
ft Q"
ofcr oOt:
X
tl
rf
+
*•O2"
0
n
IT
X
f?
C/}
ct-
4-0
V3KT
»
..*• 4 CD
U-J
rt-
3lS
o 9
0-
§-^
$5.
.— IM^*X«?
0
iic^ft
<;
0
D-(X
IN
3CD
ii
3
»3
X:^1
m
1
cr
ncr
TAM 203 Homework 1 Page 3/6
9.23)
120
100
80
60
40
20
0
-20
Xvs.T
Vvs.T
0
-2
-6
-8
-10
-12
Vvs.X
150
Vvs.X
= MOO
*P
cons-bntsPu>=
I
= 1 ^ m-
AA-
r 5-"7 mm
G,
'
TAM 203 Homework 1 Page 5/6
9.26)
function homework926 ( )% Problem 9.26 Solution% Jan 29, 2008
% VARIABLES (Assume consistent units)% +x = displacement% v = dx/dt% z = [x v] f z is the 'state vector1
% CONSTANTSc= 1 ; % drag constantpw= 1000; % density of water (kg/m^3)m= .002; % mass of bullet (kg)d= .0057; % diameter of bullet (m)
A- pi/4*dA2; % area of bullet (mA2)
% INTIAL CONDITIONSvO= 400; % initial velocityxO= 0; initial positionzO= [xO vO] ;
tspan =[0 1] ; %time interval of integration
error = le-4;% Set error tolerance and use 'event detection'options = odeset ( ' abstol ' , error, ' reltol ', error, ...
'events', @stopevent) ;
% Ask Matlab to SOLVE odes in function f rhs '[t zarray] = ode45 (@rhs, tspan, zO, options, c, pw,m, d) ;
The parameters m, c and g are passed to both% the 'rhs' function and the 'stopevent' function% Each row of zarray is the state z at one time.
%UNPACK the zarray (the solution) into sensible variablesx = zarray (:,1); x is the first column ofv = zarray (:, 2); is the second column ofdisp (x (end) ) ;
lot (t,x)itle(f Bullet Problem1)label ('Time, t'); ylabel (' Position, x')axis([0 inf -inf inf ] ) %inf self scales plot
end % end of main function
TAM 203 Homework 1 Page 6/6
% THE DIFFERENTIAL EQUATION f The Right Hand Side1
function zdot = rhs (t, z, c, pw,m, d)%UNPACK state vector z into sensible variablesx = z(l); y is the first element ofv = z(2); v is the second element
%Define Constant Area of BulletA= l/4*pi*dA2;
%The equationsxdot = v; % kinematic relation between x and vvdot = -l/2*c*pw*vA2*A/m; % F = m a
% Pack the rate of change of x, v into a rate of change% of state:zdot = [xdot vdot]1; % Has to be a column vectorend % end of rhs
^
function [value, isterminal, dir] = stopevent (t, z, c,pw,m, d)% Have to assign numbers to value, isterminal, dir%UNPACK z into sensible variablesx = z(l); x is the first element ofv = z(2); is the second element ofvalue = v-5; % stop integrating when v=isterminal = 1; 1 means stopdir = -1; -1 for decreasing, + 1 for increasing,
% 0 for any which way.end % end of stopevent
Output: The total penetration distance when the velocity has dropped to 5 m/s is 0.687 meters,Bullet Problem
co
!t±COoQ.
0.03