Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the first part of code: import matplotlib.pyplot as plt def simulateFreeFall(mass, deltaT, simulationTime): numSteps = (int)(simulationTime / deltaT) velocityList = [] elapsedTimeList =

Here is the first part of code:

import matplotlib.pyplot as plt

def simulateFreeFall(mass, deltaT, simulationTime): numSteps = (int)(simulationTime / deltaT) velocityList = [] elapsedTimeList = [] lengthList = [] accelerationList = [] for i in range(0, numSteps): elapsedTime = deltaT * i length = 0.45 * 9.8 * elapsedTime * elapsedTime velocity = 9.8 * elapsedTime elapsedTimeList.append(elapsedTime) lengthList.append(length) velocityList.append(velocity) accelerationList.append(9.81) retTuple = (elapsedTimeList, lengthList, velocityList, accelerationList) return retTuple

tup = simulateFreeFall(70, 0.01, 60) #mass 70kg, deltaT = 0.01, simulationTime = 60s plt.plot(tup[0],tup[1]) plt.title('Free Fall - No Friction') plt.xlabel('Time (s)') plt.ylabel('Fall length (m)') plt.show(); #outputs graph

Use Python 3.6image text in transcribed

Step 2 For the second step of this part, you will simulate another free fall, but this time you will incorporate air friction (also known as drag). Start by making a copy of your function from step 1, and rename it simulateFallFriction. Our function will have one new argument, in addition to the previous arguments surfaceA The surface area (in m2) of the falling person/object We'll perform this calculation by adding up all forces on our object. In this part, we have two forces: 1. 2. the force due to gravity (we'll call this Fweight) the force due to air friction (we'll call this Ffriction) Updating the length and velocity: Updating the length and the velocity will use the same procedure as in the previous step, but now the acceleration is not a constant, since it depends on air friction (which itself is dependent upon velocity) Updating the acceleration: We didn't really consider forces in the previous section, so we'll need to consider the force created by gravity, using the following formula: Freight F m * g A simplified formula for air resistance at sea level is given below: Ffriction -0.65 * surfaceArea * v * vl (lvI - absolute value of v) For the sake of this simulation, we'll use 0.2m2 for Julie's surface area Now, the total force (Ftotal Freight + Flriction) can be used to calculate the acceleration: a Ftotai / mass As before, write some Python code to call your function and collect the returned lists. Again, plot the length values vs. the elapsedTime values in MatPlotLib, using blue circles for markers. Sample Output: Fall- With Friction

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions