Merge branch 'main' of https://imsc.uni-graz.at/git/mark.schmidt/Exercises_MarkusSchmidt
This commit is contained in:
commit
0b93cbcdd3
1 changed files with 6 additions and 5 deletions
|
|
@ -10,14 +10,15 @@ def u(x, p):
|
||||||
|
|
||||||
x = np.linspace(0, 1, 200)
|
x = np.linspace(0, 1, 200)
|
||||||
|
|
||||||
p_values = [-10, -2, 0, 2, 10]
|
t = np.linspace(-1, 1, 15)
|
||||||
colors = ['purple', 'blue', 'black', 'orange', 'red']
|
p_values = 50 * np.sign(t)*np.power(t,2) #make more values around 0
|
||||||
|
|
||||||
|
cmap = plt.cm.rainbow
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
|
||||||
plt.figure(figsize=(7,5))
|
for p, color in zip(p_values, cmap(np.linspace(0, 1, len(p_values)))):
|
||||||
for p, c in zip(p_values, colors):
|
plt.plot(x, u(x, p), color=color, linewidth=2, label=f"p={p:.0f}")
|
||||||
plt.plot(x, u(x, p), label=f"p = {p}", color=c, linewidth=2)
|
|
||||||
|
|
||||||
|
|
||||||
plt.xlabel("x")
|
plt.xlabel("x")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue