## Trending News

# Why isn't my find command working? (Matlab HW help!)?

clc

h = 1.5;

g = 9.8.^2;

v = 4;

angle = 45;

t = linspace(0,1,1000);

x = v*cosd(angle)*t; %x - function

y = h + v*sind(angle)*t - 1/2*g*t.^2; % height function

disp([x',y'])

distance1 = find(y < 0) %finds value where y is less than zero.

plot(x,y)

I can't get the distance1 variable to produce 1 value that represents where y is less than zero. I don't want ALL the values, just the first one.

My professor is also asking me to plot the ground with dashed lines..

Here is what she's asking:

Plot the ground as a dashed black line. This should be a horizontal line going from 0 to

the maximum value of x (use max).

And here is the question in its entirety: (all the superficial stuff, I can do on my own such as x-label, y-label, etc.)

Problem5: Throwing a ball.

a. Start a new file in the Matlab Editor and save it as BallThrow.m

b. At the top of the file, define some constants

i. Initial height of ball at release = 1.5 m

ii. Gravitational acceleration = 9.8 m/s

2

iii. Velocity of ball at release = 4 m/s

iv. Angle of the velocity vector at time of release = 45 degrees

c. Next, make a time vector that has 1000 linearly spaced values between 0 and 1, inclusive.

d. If x is distance and y is height, the equations below describe their dependence on time and all

the other parameters (initial height h , gravitational acceleration g , initial ball velocity v , angle

of velocity vector

### 1 Answer

- KeplJoeyLv 79 years agoFavorite Answer
Why are you squaring the 9.8? The units for acceleration is m/s^2, but the number itself is 9.8, not 9.8^2.