subject

Loops are very useful for doing the same calculation over and over, very quickly.

In this problem, we will use a loop to call a function with different inputs, and store the result in an array.

You are doing an experiment where you are trying to experimentally calculate the air resistance on falling objects. To calculate this resistance, you build an apparatus that will release objects with different initial velocities at different distances. You also set up a system for measuring the exact time it takes each object to fall.

To do your air resistance calculation, you need a theoretical comparison for the amount of time it takes an object to fall in a vacuum. Thankfully you already have that function (please download fallTime. m from Canvas)! What you do not have yet is a way to call that function repeatedly for all of the distance and velocity data you have!

Write a function called timeLoop. It should take two inputs, arrays for initial velocity and distance. These two input arrays will always have equivalent lengths, as the indices of these arrays correspond to the same data point from your experiment. It should return one output, an array for the theoretical amount of time it would take for the object moving at that initial velocity to fall that distance. To accomplish this task, you should call fallTime. m inside of a loop.

For example, if you called timeLoop with the input array [2 -3 5] for initial velocities (negative numbers mean the object was moving upwards initially) and [100 150 300] for distances, your function call and resulting output would look like this:

IN Matlab

%This function calculates how long it takes an object to fall a certain
%distance given a certain initial velocity and a distance

function time = fallTime(startVelocity, distance)

g = 9.81; %m/s^2

finalVelocity = sqrt(startVelocity^2 + 2*g*distance); %m/s

time = (finalVelocity - startVelocity)/g; %s

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 2
question
Computers and Technology, 24.06.2019 00:20
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
When you type january in a cell, then copy it using the fill handle to the cells below and the data automatically changes to february, march, april, and so on, what is this feature called? auto fill automaticcopy monthfill textfill
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
What need most led to the creation of the advanced research projects agency network? darpa wanted scientists to be able to collaborate and share research easily. darpa wanted american and russian politicians to be able to communicate. darpa wanted astronauts to be able to contact nasa and the white house. darpa wanted factory owners to be able to coordinate supply chains.
Answers: 1
You know the right answer?
Loops are very useful for doing the same calculation over and over, very quickly.

In thi...
Questions
question
Mathematics, 11.11.2021 14:00
question
Mathematics, 11.11.2021 14:00
question
Biology, 11.11.2021 14:00
question
English, 11.11.2021 14:00
question
Mathematics, 11.11.2021 14:00
question
Mathematics, 11.11.2021 14:00