"Create a matrix MA which is created by multiplying matrix D (unit matrix) by matrix A <br>\n",
"Create a matrix MB by multiplying the matrix B (3x2 matrix of ones) by the transposed matrix of itself"
...
...
@@ -220,25 +220,28 @@
"\n",
"The times should be rounded to one decimal place and written in the form\n",
"``` The aircraft needs XY minutes to get from waypoint X to waypoint Y.```\n",
" - finally plot the total flight time\n",
" - finally caluclatee and print the total flight time\n",
"\n",
"#### Hint:\n",
"- The distance between two points can be calculated using the norm of the difference vector. `np.linalg.norm`.\n",
"- The distance between two points can be calculated using the norm of the difference vector. `np.linalg.norm` (with the parameter (endvector - startvector)).\n",
"- The time required to cover this distance at a given speed is calculated by dividing the distance by the speed standard.\n",
"\n",
"**Required result:** <br>\n",
"['From waypoint 1 to waypoint 2 the plane needs 17.7 minutes.', 'From waypoint 2 to waypoint 3 the plane needs 20.8 minutes.', 'From waypoint 3 to waypoint 4 the plane needs 97.6 minutes.']\n",
### 1.1.3 Calculation of determinant and eigenvalues:
Calculate the determinant of matrix C
%% Cell type:code id:5eddfe63 tags:
``` python
```
%% Cell type:markdown id:c7c7d0a9 tags:
Calculate the eigenvalues of matrix I
%% Cell type:code id:b514726e tags:
``` python
```
%% Cell type:markdown id:a8822ed4 tags:
### 1.2 Task (Advanced): Aircraft navigation
An aircraft flies along a fixed route that is defined by several waypoints. Each waypoint is represented by a vector that indicates its position in 3D space. The speed of the aeroplane is also given as a vector indicating the direction and speed at each point along the route. The time required to get from one waypoint to the next is to be calculated.
#### Given data:
- Waypoints as vectors in 3D space in km. <br>
P1 `[0, 0, 4]`, <br>
P2 `[100, 100, 2]`, <br>
P3`[300, 250, 5]`, <br>
P4 `[500, 800, 15]` <br>
- Speeds in km/min <br>
v1, v2, v3 `[8, 12, 6]`
#### Goal:
Implement a function `path_planning` that provides the following outputs:
1. The time to get from P1 to P2 from P2 to P3 and from P3 to P4.
The times should be rounded to one decimal place and written in the form
``` The aircraft needs XY minutes to get from waypoint X to waypoint Y.```
- finally plot the total flight time
- finally caluclatee and print the total flight time
#### Hint:
- The distance between two points can be calculated using the norm of the difference vector. `np.linalg.norm`.
- The distance between two points can be calculated using the norm of the difference vector. `np.linalg.norm` (with the parameter (endvector - startvector)).
- The time required to cover this distance at a given speed is calculated by dividing the distance by the speed standard.
**Required result:** <br>
['From waypoint 1 to waypoint 2 the plane needs 17.7 minutes.', 'From waypoint 2 to waypoint 3 the plane needs 20.8 minutes.', 'From waypoint 3 to waypoint 4 the plane needs 97.6 minutes.']
A time series of temperature data from our AvaNode is given, comprising hourly measurements over several days. Each measurement is stored in a 1D NumPy array.
### Goal:
Develop a function `analyze_temperatures` that calculates the statistical values for a given series of temperature data. The function should determine and return the following values:
### Task: Calculating the mechanical work of a motor
#### Background
A motor generates mechanical work that varies as a function of time. The generated work \( W \) is calculated by the integral of the power \( P(t) \) over a certain period of time \( T \). The power of the motor can be measured as discrete values in a specific time interval.
#### Aufgabe
Implement the function `calculate_mechanical_work(P, T)`, which calculates the mechanical work \( W \) using the trapezoidal integration method of `scipy.integrate.trapz` and returns it as a float. <br>
**Hint:** The trapezoidal rule calculates the area under a curve by summing the area of a series of trapezoids drawn between two adjacent points on the graph of the function. This usually provides a more accurate approximation of the integral than the simple rectangular method.
the integrator can be imported using ```from scipy.integrate import trapz ```<br>
trapz(y, x=None, dx=1.0, axis=-1) <br>
Parameters: <br>
- **`y`**: This is the array of function values that are to be integrated.
- **`x`** This is the array of x-values (most often time). If it is not specified, it is assumed that the x-values are evenly spaced. `dx`.
- **`dx`** (optional): This is the step distance between the x-values if `x` is not specified. By default, `dx=1.0`.
- **`axis`** (optional): The axis along which to integrate. By default, this is the last axis (`axis=-1`).
The following values are given:
- `P = [100, 150, 200, 250, 300]` the number of time steps can be summed with the power based on the length of the vector
- `T = 1` Time interval between measurements in seconds
**note:** the time steps t result can be optained from the length of the vector with the power values and the duration from the timesteps with the np.arange method
%% Cell type:code id:9f5a81b3 tags:
``` python
P = np.array([100, 150, 200, 250, 300]) # Performance at given points in time