Saturday, August 05, 2006

Rocket Trajectory for MATLAB 5.3

%Problem #2 Chapter #3 page 121 rocket trajectory

clc,clear

disp('Your Name')
disp('-')
disp('-')

t = 0:2:100;

for n = 1:51;
time = t(n);

h(n) = 60 + (2.13 * (time^2)) - (.0013 * (time^4)) + (.000034 * (time^4.751));
if h(n) >= 0 | h(n) <=0 [d, dtime] = max(h); [i, impact] = min(h); end
end
end
disp('This is the time in seconds after which the rocket starts to fall.')
t(dtime)
t(impact);
n = 1:51;
time = t(n);
[h(n)',time'];

for n = 1:51;
time = t(n);

h(n) = 60 + (2.13 * (time^2)) - (.0013 * (time^4)) + (.000034 * (time^4.751));
if h(n) <=0 disp('This is the time in seconds when the rocket has hit the ground.')
time
break
end
end

No comments: