| Jakanapes 2005-04-26, 4:04 pm |
| I am working on a project to graph the trajectory of a cannonball under
certain conditions.
my initial values are:
x0 //initial x position
y0 //initial y position
v0 //initial velocity
theta0 //initial angle w/regards to the x-axis.
x = [x0 y0 v0 theta0]
my sketchy function is as follows:
function xy = trajectoryODE(t,x)
vx = x(3)*cos(x(4)) //velocity in x
vy = x(3)*sin(x(4)) //velocity in y
D = ((c*rho*s)/2)*((vx - wt)^2 + vy^2) //drag
vDot = -(D/m) - g*sin(x(4)) //acceleration
thetaDot = -(g/(x(3))*cos(x(4)) //rate of change of theta w/regards to
x
xy(1) = vx;
xy(2) = vy;
xy(3) = vDot;
xy(4) = thetaDot;
I've used the ode solvers before, but not with a changing acceleration.
Am I on the right track?
xy(1) and xy(2) should be the new x and y values, xy(3) should be the
new velocity and xy(4) should be the new angle theta.
|