## In this task you will practice interpolation and integration with a task from the mechanics.

### computer science

##### Description

In this task you will practice interpolation and integration with a task from the mechanics. A vehicle starts from a standstill at t = 0, the speed of the vehicle is then measured on some occasions where the last measurement takes place at t = 10s. Your task is to first interpolate a polynomial between the given points t, v (t) and then to calculate from this polynomial how far the vehicle has traveled since you implement and apply the trapezoidal rule.

The measuring points are given in the following code which is a good start:

t = [0 2 5 8 10]
v = [0 20 60 40 20]

Wikipedia article on trapeze rules:

https://en.wikipedia.org/wiki/Trapetsregeln (Links to an external page.)

In matlab, one can gausseliminate m h a "\" as the operator.

For example,
A = [1 2; 3 4]
y = [1 2]

The system A * x = y is solved by x = A \ y

Some useful food lab functions for this task are "ones" (for creating A) and "polyval" for creating polynomial values ​​when the coefficients ck in the polynomial are determined. When you have 5 points, the polynomial becomes degree 4.