BaşlayınÜcretsiz Başlayın

Reasons for Modeling: Interpolation

One common use of modeling is interpolation to determine a value "inside" or "in between" the measured data points. In this exercise, you will make a prediction for the value of the dependent variable distances for a given independent variable times that falls "in between" two measurements from a road trip, where the distances are those traveled for the given elapse times.

context figure

Bu egzersiz

Introduction to Linear Modeling in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Inspect the predefined data arrays, times and distances, and the preloaded plot.
  • Based on your rough inspection, estimate the distance_traveled away from the starting position as of elapse_time = 2.5 hours.
  • Assign your answer to distance_traveled.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Compute the total change in distance and change in time
total_distance = ____[-1] - ____[0]
total_time = ____[-1] - ____[0]

# Estimate the slope of the data from the ratio of the changes
average_speed = total_distance / total_time

# Predict the distance traveled for a time not measured
elapse_time = 2.5
distance_traveled = average_speed * elapse_time
print("The distance traveled is {}".format(distance_traveled))
Kodu Düzenle ve Çalıştır