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, 22.06.2019 00:40
Reading characters and strings from the keyboard: consider the following c++ program 1. #include 2. #include 3. using namespace std; 4. mystring1 5. 6. int main() 7. { 8. 9. string mystring1, mystring2; mychar1 10. 11. 12. char mychar1, mychar2; 13. 14. cout< < "enter a string: "; mychar2 15. 16. cin> > mystring1; // 17. cin.get(mychar1); 18. cin> > mychar2; 19. getline(cin,mystring2); mystring2 20. 21. 22. cout<
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Which of these is most responsible for differences between the twentieth century to the twenty-first century?
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Three out of five seniors remain undecided about a college major at the end of their senior year.
Answers: 3
You know the right answer?
Loops are very useful for doing the same calculation over and over, very quickly.

In thi...
Questions
question
Social Studies, 26.10.2020 17:20
question
Computers and Technology, 26.10.2020 17:20
question
Mathematics, 26.10.2020 17:20
Questions on the website: 13722359