CSC 113, Fall 2010
Lab Assignment 8
The various commands below are to be typed into the command window; observe their outputs.
1.
Projectile trajectory!
From basic physics, the
x
and
y
displacements of a projectile fired at
an initial velocity
v
0
with an angle
θ
with respect to the horizontal, as a function of time
t
,
are given by
x
(
t
)
=
v
0
t
cos
θ
y
(
t
)
=
v
0
t
sin
θ

1
2
gt
2
Here
g
= 9
.
8m
/
sec
2
is the acceleration due to gravity. We can set up symbolic expressions
in M
ATLAB
as follows:
>> syms v0 t theta g
>> x_of_t = v0
*
t
*
cos
(theta)
>> y_of_t = v0
*
t
*
sin
(theta)  (1/2)
*
g
*
tˆ2
2. The
solve
function will set an expression to zero, and then solve for the variable so declared.
The impact time is obtained for values of
t
such that
y
(
t
) = 0
.
This can be computed
symbolically as
>> impact_time = solve(y_of_t,t)
Does it make sense that
impact
¯
time
has two solutions?
3. The
subs
function allows substitution of one variable by another, or by a value. For example,
if
>> E1 = sym(’a
*
xˆ2 + b
*
x + c’)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
then
>> subs(E1, ’x’, ’y’)
will substitute
y
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '10
 PhillipRegali
 Trajectory, Trajectory of a projectile

Click to edit the document details