Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Activity # 2 : More linear interpolation - individual In the team lab, your team put together a program that interpolated between two position values

Activity #2: More linear interpolation - individual
In the team lab, your team put together a program that interpolated between two position values based on the time values when each positon was observed. This was a one-dimensional (1D) interpolation, since you were interpolating only a single value, the distance traveled by the ISS. You are now going to extend that program to one that will linearly interpolate between two points in 3D.
Let's say we are tracking the change of a satellite's position with time. So, at time to the position is (x0,y0,z0) and at time t 2 the position is (x2,y2,z2). What is the position (x1,y1,z1) at some time t1 between to and t2?
Refer again to the Linear Interpolation material associated with the team lab. That material describes the development of the equation representing linear interpolation of a dependent variable y versus an independent variable x. For the current problem, what varies linearly with what? What are the dependent variable(s)? What are the independent variable(s)?
Let's assume that each of the position variables (x,y,z) varies linearly with time (t). Therefore, time (t) is the independent variable in each case. This means we can perform linear interpolation three separate times to get what we need. This can be done in three steps: 1) linearly interpolate between (0,x0 and (t2,x2) for t1 with x1 as the result; 2) repeat for (0,y0 and (t2,y2 for t1 with y1 as the result; 3) repeat for (t0,z0) and (t2,z2) for t1 with z1 as the result. The result will be (x1,y1,z1) associated with time t1.
a) Write a program named more_linear_interpolation.py that will take two observed 3D positions at two points in time, and then will calculate the 3D position at a third point in time. Let's consider only times between the two observed times. You should output the x,y, and z values for that position on separate lines. Begin by identifying the variables you will use, the names for those variables, and the computations that should occur for those variables. Then, write a program that will output the 3D position of the interpolated point on 3 separate lines.
For this initial program, use the following data values:
At time 12 seconds, observed position was (8,6,7) meters
At time 85 seconds, observed position was (-5,30,9) meters
You want to find the position at time 30 seconds
Example output:
At time 30.0 seconds:
x1=4.794520547945206m
y1=11.917808219178081m
z1=7.493150684931507m
b) Now, add to your file more_linear_interpolation.py from above. Modify your program in the following ways:
i. When printing the position, follow the output by a line of dashes ("
ii. Instead of just computing the interpolation at one point and printing the result, you will now compute it at 5 points. You may copy and paste the portion of your code that is needed to recompute interpolation 5 times.
iii. Create variables for the starting time of interpolation, and the ending time of interpolation. Display the results from interpolating at 5 points, evenly spaced from the beginning time to the ending time, inclusive.
iv. Interpolate, starting at time 30 seconds and ending at time 60 seconds, printing the result each time. The line of dashes will separate each computation. (Note: later we will see how we can do this more efficiently, without copying-and-pasting code, but for now, copy-and-paste your code.)
Example output (first two times only):
At time 30.0 seconds:
x1=4.794520547945206m
y1=11.917808219178081m
z1=7.493150684931507m
At time 37.5 seconds:
x2=3.4589041095890414m
y2=14.383561643835616m
z2=7.698630136986301m
((PLEASE SOLVE IT SO IT CAN PRODUCED THESE OUTPUTS ))
image text in transcribed

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

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

2. Identify conflict triggers in yourself and others

Answered: 1 week ago