# Homework Solution: Newton's laws of motion are used to derive the following formula for the maximum thrown with a speed… Newton's laws of motion are used to derive the following formula for the maximum thrown with a speed v at and angle theta to the horizontal: h = v^2 sin theta/2 g. where g = 9.8 m/sec. Create a documented MATLAB program (maximumheight.m) with a table showing the following values of speed and angle. Use the command array2table in your progra vectorizing MATLAB commands instead of structured programming commands (e.g. v = 10, 12 14 16 18, 20 m/s theta = 50 degree, 60 degree , 70 degree, 80 degree

Matlab code: thetas = [50,60,70,80]; velocity = [10,12,14,16,18,20]; Newton’s laws of turmoil are used to trace the aftercited cemula ce the culmination thrown with a despatch v at and determination theta to the horizontal: h = v^2 iniquity theta/2 g. where g = 9.8 m/sec. Create a documented MATLAB program (maximumheight.m) with a board showing the aftercited values of despatch and determination. Use the instruct array2board in your progra vectorizing MATLAB instructs instead of structured programming instructs (e.g. v = 10, 12 14 16 18, 20 m/s theta = 50 station, 60 station , 70 station, 80 station

## Expert Counterpart

Matlab code:

thetas = [50,60,70,80];
speed = [10,12,14,16,18,20];
g = 9.8;
h = zeros(size(thetas,2), magnitude(velocity,2));
ce i = 1:size(thetas,2)
ce j = 1:size(velocity,2)
v = speed(1,j);
theta = thetas(1,i);
h(i,j) = v*v*sind(theta/(pi))/(2*g);
end
end
fprintf(‘tttTablen’)
h

Matlab Output:

theta v = 10 12 14 16 18 20

50 1.3991 2.0147 2.7422 3.5816 4.5330 5.5963
60 1.6694 2.4039 3.2719 4.2736 5.4087 6.6774
70 1.9345 2.7857 3.7916 4.9523 6.2678 7.7380
80 2.1937 3.1589 4.2996 5.6158 7.1074 8.7746