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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:40, shaylawaldo11
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
Answers: 3
image
Computers and Technology, 23.06.2019 00:30, lilobekker5219
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
image
Computers and Technology, 23.06.2019 08:30, Calirose
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
image
Computers and Technology, 23.06.2019 18:50, ana7496
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
You know the right answer?
Loops are very useful for doing the same calculation over and over, very quickly.

In thi...

Questions in other subjects: