Tenferenzu
Vice Admiral Pro
- Registriert
- Okt. 2017
- Beiträge
- 6.597
Hi,
ich stecke hier gerade an etwas vermutlich absolut trivialem fest. Ich möchte folgende Funktion in Python/Pyplot darstellen, komme aber nicht auf den richtigen Nenner.
Ich bin einfach einem Tutorial gefolgt und das hat auch soweit geklappt mit folgendem Code:
Wenn ich das allerdings abwandle auf meine Formel, bekomme ich folgenden Fehler:
Ich bin mir sicher, dass die Lösung des Problems trivial ist aber ich komm einfach nicht drauf
Danke schonmal für die Hilfe!
ich stecke hier gerade an etwas vermutlich absolut trivialem fest. Ich möchte folgende Funktion in Python/Pyplot darstellen, komme aber nicht auf den richtigen Nenner.
Ich bin einfach einem Tutorial gefolgt und das hat auch soweit geklappt mit folgendem Code:
Python:
import math
from matplotlib import pyplot
import numpy
def f(x,a,b,c):
return a*x**2+b*x+c
xlist = numpy.linspace(0,100, num=101)
ylist = f(xlist, 2, 25, 4)
Wenn ich das allerdings abwandle auf meine Formel, bekomme ich folgenden Fehler:
TypeError: only size-1 arrays can be converted to Python scalars
Python:
import math
from matplotlib import pyplot
import numpy
def psr(t,tau,n):
return((1 / tau) * ((t / tau) **( n - 1)) * ((1 / math.factorial(n - 1)) * math.exp(-1 * t / tau)))
print(numpy.linspace(0,100, num=101))
xlist = numpy.linspace(0,100, num=101)
ylist = psr(xlist, 2, 25)
pyplot.plot(xlist, ylist)
Ich bin mir sicher, dass die Lösung des Problems trivial ist aber ich komm einfach nicht drauf

Danke schonmal für die Hilfe!
