feat: Plot Graphs
This commit is contained in:
parent
a4a7de2451
commit
4e31672189
@ -1 +1,32 @@
|
|||||||
# %%
|
# %%
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
# Parameter
|
||||||
|
N = 200
|
||||||
|
|
||||||
|
# Funktionen
|
||||||
|
f_a = lambda x: -(1 / 3) * x**3 + (5 / 2) * x**2 - 4 * x + 1
|
||||||
|
f_b = lambda x: np.abs(x**2 - 4 * x + 3)
|
||||||
|
|
||||||
|
# Daten
|
||||||
|
x_a_data = np.linspace(0, 2, N)
|
||||||
|
x_b_data = np.linspace(0, 4, N)
|
||||||
|
|
||||||
|
f_a_data = f_a(x_a_data)
|
||||||
|
f_b_data = f_b(x_b_data)
|
||||||
|
|
||||||
|
# Plot
|
||||||
|
plt.figure(1)
|
||||||
|
plt.plot(x_a_data, f_a_data)
|
||||||
|
plt.xlabel("x")
|
||||||
|
plt.ylabel("y")
|
||||||
|
plt.grid("on")
|
||||||
|
plt.axis("image")
|
||||||
|
|
||||||
|
plt.figure(2)
|
||||||
|
plt.plot(x_b_data, f_b_data)
|
||||||
|
plt.xlabel("x")
|
||||||
|
plt.ylabel("y")
|
||||||
|
plt.grid("on")
|
||||||
|
plt.axis("image")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user