我已尝试使用以下代码使我的数据适合Biot-Savart法则:
_fit
我在data.csv中的数据:
pyspark.ml.tuning.CrossValidator
model.apm中的脚本:
# Add APMonitor toolbox available from
# http://apmonitor.com/wiki/index.php/Main/PythonApp
from apm import *
# server and application
s = 'http://byu.apmonitor.com'
a = 'regression'
# clear any prior application
apm(s,a,'clear all')
# load model and data files
apm_load(s,'model.apm')
csv_load(s,'data.csv')
# configure parameters to estimate
apm_info(s,'FV','a')
apm_info(s,'b')
apm_option(s,'a.status',1)
apm_option(s,'b.status','nlc.imode',2)
# solve nonlinear regression
output = apm(s,'solve')
print(output)
# retrieve solution
z = apm_sol(s,a)
# print solution
print('Solution')
print('a = ' + str(z['a'][0]))
print('b = ' + str(z['b'][0]))
# plot solution
from matplotlib.pyplot import *
figure(1)
plot(z['xm'],z['ym'],'o')
plot(z['xm'],z['y'],'x')
xlabel('x')
ylabel('y')
legend(['Measured','Predicted'])
show()
不起作用。适合的只是一条线。 Plot and Fit Result我也尝试过用不同的代码和在乳胶中安装它,但是我总是能做到这一点。我需要拟合来计算参数a和b,它们是比奥-萨瓦特定律中的半径和安培数,但我真的不知道从这里出发。不胜感激