我想找到a系数的最小二乘解
z = (a0 + a1*x + a2*y + a3*x**2 + a4*x**2*y + a5*x**2*y**2 + a6*y**2 +
a7*x*y**2 + a8*x*y)
Run Code Online (Sandbox Code Playgroud)
给定的阵列x,y和z长度20的基本上我正在寻找的等效numpy.polyfit但对于一个二维多项式.
这个问题很相似,但解决方案是通过MATLAB提供的.
嗨,我正在尝试根据我的数据框中的数据制作箭袋图的动画
我将这样的数据存储在 Pandas DataFrame 中,有点像这样
QuivXLoc QuivYLoc QuivXVal QuivYVal QuivColorVal QuivPlotNum
0 -70.22 -127.241 1.624 -0.879 1.846623 1
1 -61.74 -127.241 -0.973 -0.027 0.973375 1
2 -65.98 -121.835 0.046 2.416 2.416438 1
3 -74.46 -121.835 -0.151 2.673 2.677262 1
4 -78.70 -116.429 1.073 -0.954 1.435773 2
Run Code Online (Sandbox Code Playgroud)
我目前正在像这样绘制它,它可以完美地为每个序列号生成单独的图。
for seq in quidf['QuivPlotNum'].unique():
temp=quidf[quidf['QuivPlotNum']==seq] ## make subset to plot
plt.quiver(temp['QuivXLoc'], temp['QuivYLoc'], temp['QuivXVal'], temp['QuivYVal'], # data
temp['QuivColorVal'], # colour the arrows based on this array
cmap=cm.jet, # colour map
headlength=3) # length of …Run Code Online (Sandbox Code Playgroud)