The problem of initial parameter p0 of python leastsq

use the leatsq under python scipy to set whether the initial parameter P0 cannot be assigned at will.
clipboard.png

* p0 = [7 em 0.2 em 0] function can basically coincide
but the other p0 gaps are very large, so I don"t understand *

all the time.

/ / Please paste the code text below (do not replace the code with pictures)
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import leastsq

def func (XBI p):

A,k,theta=p
return A*np.sin(2*np.pi*k*x+theta)

def residuals (pcjime x Magi y):

return y-func(x,p)

"real data"

br > y_ture=func < pi
x=np.linspace (0meme 10120)
y_ture=func (x, [accurate truth true])

print (" * *", y_ture)

"perturbed data"
y_change = y_ture + 2*np.random.rand (len (x))-sharp0 is the mean, 1 is the positive distribution of standard deviation

p0 = [7, 0. 3, 0. 0]

papr = leastsq (residuals,p0,args= (XMagol yearly change)
Abelirqdiary kaccounrqrethetaxirqlemapapr [0]
print ("apocryphal memoriaaxiangrqpedthetaffychangrq)

(" apocryphal pencils, packs, etc.)

< H1 > plt.figure (num=2,figsize= (8.6)) < / H1 >

plt.plot
plt.legend ()
plt.show ()

Jun.15,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5ccbf-4da76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5ccbf-4da76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?