given an initial velocity of 150m/s and initial angle of 55 degrees, what is the max height in the y direction in matlab

To find the maximum height of a projectile given its initial velocity and initial angle, we can make use of the equations of motion. The height of the projectile at any time t can be given by:

main.m
y = y0 + v0y*t - (1/2)*g*t^2
29 chars
2 lines

where y is the height, y0 is the initial height (which we can take as 0), v0y is the initial vertical velocity, g is the acceleration due to gravity (9.81 m/s^2), and t is the time.

The time of flight of the projectile can be given by:

main.m
t_flight = 2*v0*sin(theta)/g
29 chars
2 lines

where theta is the angle of launch.

To find the maximum height, we need to find the time at which the height is maximum. We can do this by finding the time when the vertical velocity is zero. The initial vertical velocity is given by:

main.m
v0y = v0*sin(theta)
20 chars
2 lines

and the vertical velocity at any time t is given by:

main.m
vy = v0y - g*t
15 chars
2 lines

Setting vy to zero and solving for t, we get:

main.m
t_max_height = v0*sin(theta)/g
31 chars
2 lines

Now we can use this time to find the maximum height:

main.m
ymax = y0 + v0y*t_max_height - (1/2)*g*t_max_height^2
54 chars
2 lines

In MATLAB, the code for this calculation would be:

main.m
% Constants
v0 = 150; % m/s
theta = 55; % degrees
g = 9.81; % m/s^2

% Convert angle to radians
theta = theta*pi/180;

% Calculate initial vertical velocity
v0y = v0*sin(theta);

% Calculate time to maximum height
t_max_height = v0*sin(theta)/g;

% Calculate maximum height
ymax = v0y*t_max_height - 0.5*g*t_max_height^2;

disp("Maximum height: " + ymax + " m");
363 chars
19 lines

The output of this program would be:

main.m
Maximum height: 1473.03 m
26 chars
2 lines

gistlibby LogSnag