hi
I am struggeling with a homeworkassignment.
i Am trying to streamlineplot, but i have only found this scetch. how do i go from this scetch to getting my txt file to work wit a simmilar approach? my assignment is at the bottom.
, you will find data describing a velocity field on a rectangle of size 100x100. For each point in this rectangle, a vector is stored in data.txt. In total, there are 100 * 100 * 2 = 20000 numbers in this file. The data is organized so that the vector belonging to the coordinate (i, j) in the rectangle is in place 100 * j + in the data (this is x coordinate to vector) and space 100 * 100 + 100 * j + i (y coordinate to vector).
With the tool you choose, you must perform the following two tasks:
Task 1:
a) Plot how the currents go in the vector field
b) Plot the speed at each point using a color plot.
c) Plot the divergence at each point using a color plot.
d) Plot the z coordinate of the rotation (ie, curl) at each point using a color plot.
I am struggeling with a homeworkassignment.
i Am trying to streamlineplot, but i have only found this scetch. how do i go from this scetch to getting my txt file to work wit a simmilar approach? my assignment is at the bottom.
import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec w = 3 Y, X = np.mgrid[-w:w:100j, -w:w:100j] U = -1 - X**2 + Y V = 1 + X - Y**2 speed = np.sqrt(U**2 + V**2) fig = plt.figure(figsize=(7, 9)) gs = gridspec.GridSpec(nrows=3, ncols=2, height_ratios=[1, 1, 2]) # Varying density along a streamline ax0 = fig.add_subplot(gs[0, 0]) ax0.streamplot(X, Y, U, V, density=[0.5, 1]) ax0.set_title('Varying Density')In the data.txt file
, you will find data describing a velocity field on a rectangle of size 100x100. For each point in this rectangle, a vector is stored in data.txt. In total, there are 100 * 100 * 2 = 20000 numbers in this file. The data is organized so that the vector belonging to the coordinate (i, j) in the rectangle is in place 100 * j + in the data (this is x coordinate to vector) and space 100 * 100 + 100 * j + i (y coordinate to vector).
With the tool you choose, you must perform the following two tasks:
Task 1:
a) Plot how the currents go in the vector field
b) Plot the speed at each point using a color plot.
c) Plot the divergence at each point using a color plot.
d) Plot the z coordinate of the rotation (ie, curl) at each point using a color plot.