ich habe eine Funktion
Code: Alles auswählen
def model(x,y):
#some calculations
return count
Nun kenne ich durch ein anderes Modell simulierte Outputs also ich weiß zb, dass
model(1,0.92*y) = 28
model(1,0.95*y) = 37
model(1,1*y) = 50
...
nun möchte ich gerne in meinem Modell den Parameter y so finden, dass der Fehler zu den Daten klein wird - also y optimal finden.
Dazu habe ich folgendes gemacht
Code: Alles auswählen
root = 38.69140625
xdata = np.array([0.92*root,root,1.05*root])
ydata = np.array([28,100,110])
y0=np.array([1,1,1])
def g(y,xdata,ydata):
return ydata - HH_model(xdata,y)
fit = optimize.leastsq(g, y0, args=(xdata, ydata))
Was ist das problem?ValueError: could not broadcast input array from shape (3) into shape (1)
Danke und LG