Height versus Velocity Matlab Help

Height versus Velocity

In introductory physics courses Iewton’s laws of motion are used to derive the following formula for the maximum height li achieved by an object thrown with a speed v at an angle B to the horizontal

In introductory physics courses newton’s laws of motion are used to derive the following formula for the maximum height li achieved by an object thrown with a speed v at an angle B to the horizontal.

Capture

Create a table showing the maximum height for the following values of v and B:

Capture

The rows in the table should correspond to the speed values, and the columns should correspond to the angles.

Solution

We must first convert the angles to radians before using the sin function. In order to . use element-by-element operations, we must make sure that the arrays’ representing speed v and angle () are the same size (they must have the same numb~r of row~ and columns). Because there are six speed values and four angles, and a given speed must correspond to a row, we must create a 6 x 4 array of speeds, with the columns repeated.
Similarly, we must create a 6 x 4 array of angles, with the rows repeated. The script is shown below. Note the use of the empty array [] to provide an initial array to use in the for loops.

for loops.
% Input data.
g 9.8;
v = [10:2:20];th [50:10:80]
thr = th*(pi/180);
% Create the 6 x 4 array of speeds.
vel= [];
for k=1:length(th)
vel = [veL v’];
end
% Create the 6 x 4 array of angles.
theta= [];
for k=1:length(v)
theta = [theta;thr];
end
% Compute the 6 x 4 array of height values.
h = (vel.”2.*(sin(theta)).”2)1(2*g)

% create the 6 x 5 array of speeds and heights.
H = [v’ ,h);
% Create the 7 x 5 array for the table.
table = [O,th;H)
A number (in this case, 0) in the last line is required to match the number of columns in H. The following table shows the results. rounded to one decimal place. In Chapter 3- we will see how to control the number of decimal places displayed, and how to format a table with headings. From the table, we can see that th~ maximum height is 8.8 m if
v = 14 rnIs and () = 70°.

Capture

Posted on July 30, 2015 in Numeric Cell And Structure Arrays

Share the Story

Back to Top
Share This