
With those three lines, you're overwriting the user-input values of $v$, $k$ and $dt$, so you need to delete them. % DELETE THIS v = 30 %initial velocity of the ball % DELETE THIS k = 0.1 %some constant of proportionality 01.01.1 ĮDIT: Change your function to: function T = freefallX(v,k,dt) %defining the function The acceleration in this motion is constant because the. Thus, free-fall motion is also popularly known as acceleration due to gravity. The acceleration is caused by this external force on the object, hence the motion of the object will be accelerated.
#FREEFALL FORMULA FREE#
Let's say you also want to vary $dt$ from $.01$ to $.1$ in increments of $.01$. Free fall is the movement of an object or body only under the influence of gravity. For instance, let's say you've already defined your function, and have values of $v$ and $k$ stored. Once you have your function defined, you can store different values of the function for different values of $dt$. To this end, I tried to plot a graph of the different $T$'s against the corresponding $dt$. Now I wanted to see how these different $T$'s vary with time-step. For different time-steps I get different values of $T$. The result I get from the above algorithm is dependent on the choice of the time-step "$dt$". T = time %give the time until reversal of motion, i.e, v=0 Time = time + (dt) %increase time in steps of dt

V = v + dv %velocity of ball at any instant

While v >= 0 %defining the while-conditionĪ = -9.81 -(k*v) %net acceleration of ball K = 0.1 %some constant of proportionality MATLAB function T = freefallX(v,k,dt) %defining the function I defined a function $T$ that takes the variables $v, k, dt$ as arguments and returns the time $T$ until the ball reverses motion with the help of the while loop as described below: So I wrote the following algorithm in order to solve this problem in MATLAB. How long does it take for the ball to reverse its motion? Take $ k = 0.1$ and solve the problem using a while loop. Assume the acceleration due to friction against the air is directed opposite to the direction of the velocity, and proportional to the speed of the ball, such that the total acceleration of the ball is $ a = -g - kv$, where $g$ is the acceleration due to gravity and $v$ is the speed of the ball. A ball is thrown up into the air at an initial speed v of $30$ $m /s $.
