Вы находитесь на странице: 1из 6

USING SYMBOLIC MATH TO SOLVE A BALLISTICS PROBLEM We can use the symbolic math capabilities of MATLAB to explore the

e equations representing the trajectory of an unpowered projectile, such as the cannonball shown in Figure 12.5 . Range vertical distance horizontal distance Figure 12.5 The range of a projectile depends on the initial velocity and the launch angle. We know from elementary physics that the distance a projectile travels horizontally is dxv0 t cos1u2 and the distance traveled vertically is dy v0 t sin(u) 1 2 gt 2 where v0velocity at launch, t time, u launch angle, and g acceleration due to gravity. Use these equations and MATLAB

s symbolic capability to derive an equation for the distance the projectile has traveled horizontally when it hits the ground (the range). 1. State the Problem Find the range equation. 2. Describe the Input and Output Input Equations for horizontal and vertical distances Output Equation for range 3. Develop a Hand Example dy v0 t sin1u2 -1 2 gt 20 Rearrange to give v0 t sin1u2 1 2 gt 2 12.2 Solving Expressions and Equations 445 Divide by t and solve: t 2v0sin1u2 g Now substitute this expression for t into the horizontal-distance formula to obtain dxv0 t cos1u2

rangev0a 2v0sin1u2 g bcos1u2 We know from trigonometry that 2 sin u cos u is the same as sin12u2, which would allow a further simplification if desired. 4. Develop a MATLAB Solution First define the symbolic variables: syms v0 t theta g Next define the symbolic expression for the vertical distance traveled: Distancey = v0 * t *sin(theta) - 1/2*g*t^2; Now define the symbolic expression for the horizontal distance traveled: Distancex = v0 * t *cos(theta); Solve the vertical-distance expression for the time of impact, since the vertical distance0 at impact: impact_time = solve(Distancey,t) This returns two answers: impact_time = [0] [ 2*v0*sin(theta)/g] This result makes sense, since the vertical distance is zero at launch and again at impact. Substitute the impact time into the horizontal-distance expression. Since we are interested only in the second time, well need to use impact_time(2) : impact_distance = subs(Distancex,t,impact_time(2)) The substitution results in an equation for the distance the projectile has traveled when it hits the ground: impact_distance = 2*v0^2*sin(theta)/g*cos(theta)

5. Test the Solution Compare the MATLAB solution with the hand solution. Both approaches give the same result. MATLAB can simplify the result, although it is already pretty simple. We chose to use the simple command to demonstrate all the possibilities. The command simple(impact_distance) (continued) 446Chapter 12 Symbolic Mathematics gives the following results: simplify: (v0^2*sin(2*theta))/g radsimp: (2*v0^2*cos(theta)*sin(theta))/g simplify(100): (v0^2*sin(2*theta))/g combine(sincos): (v0^2*sin(2*theta))/g combine(sinhcosh): (2*v0^2*cos(theta)*sin(theta))/g combine(ln): (2*v0^2*cos(theta)*sin(theta))/g factor: (2*v0^2*cos(theta)*sin(theta))/g expand: (2*v0^2*cos(theta)*sin(theta))/g combine: (2*v0^2*cos(theta)*sin(theta))/g rewrite(exp): (2*v0^2*((1/exp(theta*i))/2 +exp(theta*i)/2)*(((1/exp(theta*i))*i)/ 2-(exp(theta*i)*i)/2))/g rewrite(sincos): (2*v0^2*cos(theta)*sin(theta))/g rewrite(sinhcosh): (2*v0^2*cosh(-theta*i)*sinh (-theta*i)*i)/g rewrite(tan): -(4*v0^2*tan(theta/2)*(tan(theta/2)^

2-1))/(g*(tan(theta/2)^2 + 1)^2) mwcos2sin: -(2*v0^2*sin(theta)*(2*sin(theta/2)^ 2-1))/g collect(v0): ((2*cos(theta)*sin(theta))/g)*v0^2 ans = (v0^2*sin(2*theta))/g

Xc nh phng trnh chuyn ng ca tn la

1. Yu cu Tn la dch chuyn bng dng kh y t ui. Dng kh y ny sinh ra bng cc phn ng t chy nhin liu cha trong tn la nn khi lng ca n gim dn theo thi gian. Gii phng trnh nh lut II Newtom cho tn la: Vi m l khi lng ca tn la, v l vn tc ca dng kh thot ra. Gii phng trnh ny ta xc nh c gia tc ca tn la t ta suy ra phng trnh chuyn ng ca n. Bi tp ny yu cu sinh vin s dng MATLAB biu din bng th phng trnh chuyn ng ca tn la y(t).

2. iu kin 1) Sinh vin cn c kin thc v lp trnh c bn trong MATLAB. 2) Tm hiu cc lnh Matlab lin quan symbolic v ha. 3. Nhim v Xy dng chng trnh Matlab:

Nhp vo cc thng s tc t nhin liu dm/dt, khi lng, v tr ban u ca tn la, vn tc y kh ca tn la v. 2. S dng cng c Symbolic xc nh phng trnh chuyn ng ca tn la v biu din bng th

Ch : Sinh vin c th dng cc cch tip cn khc khng dng symbolic.