Untitled

 avatar
unknown
plain_text
10 months ago
1.4 kB
12
Indexable
import matplotlib.pyplot as plt
import numpy as np

# Zeitachse in ms
t = np.linspace(0, 10, 1000)

# Spannungskurve eines Aktionspotenzials (vereinfacht)
V_rest = -70
V_threshold = -55
V_peak = 40

# Spannungskurve erstellen
V = np.full_like(t, V_rest)

# Phasen definieren
# Ruhepotenzial: 0-1 ms
V[(t >= 0) & (t < 1)] = V_rest

# Depolarisation: 1-2.5 ms
V[(t >= 1) & (t < 2.5)] = np.linspace(V_rest, V_peak, np.sum((t >= 1) & (t < 2.5)))

# Repolarisation: 2.5-4 ms
V[(t >= 2.5) & (t < 4)] = np.linspace(V_peak, V_rest - 10, np.sum((t >= 2.5) & (t < 4)))

# Hyperpolarisation: 4-6 ms
V[(t >= 4) & (t < 6)] = np.linspace(V_rest - 10, V_rest, np.sum((t >= 4) & (t < 6)))

# Wieder Ruhepotenzial
V[t >= 6] = V_rest

# Plot erstellen
fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(t, V, label='Membranpotenzial', color='blue')

# Refraktärzeiten einfärben
ax.axvspan(1, 2.5, color='red', alpha=0.3, label='Absolute Refraktärzeit')
ax.axvspan(2.5, 6, color='orange', alpha=0.3, label='Relative Refraktärzeit')

# Schwellenwert markieren
ax.axhline(V_threshold, color='grey', linestyle='--', linewidth=1, label='Schwellenwert')

# Beschriftungen und Legende
ax.set_title('Aktionspotenzial mit Refraktärzeiten', fontsize=14)
ax.set_xlabel('Zeit (ms)')
ax.set_ylabel('Membranpotenzial (mV)')
ax.legend()
ax.grid(True)

plt.tight_layout()
plt.show()

Editor is loading...
Leave a Comment