1stOpt多参数约束拟合代码错误
求助1stopt多参数非线性代码错误,去掉保证扩散系数大于0的两行代码可以运行,得出的解和文献结果相差甚远,加入两行约束条件程序报错,请大神指点如何加上约束条件能正常运行代码如下:
Title "Nonlinear Fit for Defect diffusion coefficient";
Constant F=96485.334,R=8.3145,b3=0,d3=0;//法拉第常数F,R气体常数,文献中的两个参数设置为0;
VarConstant T=[773.15,973.15,1073.15];
Parameters a1[0,1E-4],b1,c1,d1,a2[0,1E-4],b2,c2,d2,a3[0,1E-4],c3;//a1,a2,a3为参数预指数因子;
Variables y,x1,x2,x3,x4;//y为离子导电率,x1,x2,x3为各离子浓度
Function y=(F^2)*x1*(a1*(1+b1*x4))*exp(-(c1+d1*x4)/(R*T))/(R*T)+(F^2)*x2*(a2*(1+b2*x4))*exp(-(c2+d2*x4)/(R*T))/(R*T)+(4*F^2)*x3*(a3*(1+b3*x4))*exp(-(c3+d3*x4)/(R*T))/(R*T);
a1*(1+b1*x4)>0;//保证扩散系数大于0;
a2*(1+b2*x4)>0;//保证扩散系数大于0;
RowData;
119685.18,124330.77,127828.002,130751.07,132786.77;
4403.185,4851.994,5364.097,5588.501,5715.09;
214.3,185.53,151.007,116.483,87.71;
789.697,501.999,312.118,185.531,151.007;
0.0274,0.0174,0.0108,0.0064,0.0052;
RowData;
50940.98,64564.546,69523.315,80276.015,84869.4,94160.57,97083.63,103764.92,106061.615,106374.8;
983.51,1362.565,1621.014,2160.885,2448.05,2993.664,3246.37,3694.35,3883.88,4205.5;
2034.532,1460.2,1236.21,914.587,822.694,627.422,564.246,472.353,437.893,409.176;
3441.642,2930.49,2706.499,2321.697,2068.992,1712.91,1586.554,1299.39,1173.04,1012.223;
0.119,0.1015,0.09375,0.0804,0.0717,0.05934,0.055,0.045,0.0406,0.0351;
RowData;
25155.38,37004.228,41649.812,53864.044,58509.628,70097.488,74429.887,83460.067,88105.65;
593.555,791.372,940.732,1350.516,1509.876,2141.63,2397.74,2966.884,3251.455;
4071.022,3092.095,2682.312,1919.659,1669.236,1225.304,1065.944,815.521,752.915;
4674.315,4071.022,3757.993,3188.85,2932.735,2460.346,2204.231,1828.596,1669.236;
0.162,0.141,0.13,0.1105,0.1016,0.085,0.0764,0.063,0.0578;
程序报错:
Incompatible types: 'Double' and 'Boolean'
Incompatible types: 'Double' and 'Boolean'
Compile failed, check your program codes please! 返回小木虫查看更多
参考下:
Root of Mean Square Error (RMSE): 1512.6424091951
Sum of Squared Residual: 54914089.394293
Correlation Coef. (R): 0.974780606831772
R-Square: 0.950197231455318
Adjusted R-Square: 1.17033437542122
Determination Coef. (DC): 0.950332931884681
F-Statistic: -35.7233854532568
Parameter Best Estimate
-------------------- -------------
a1 3.00320288098963E-5
b1 -6.17282059059677
c1 5688.58025090443
d1 -127407.822744204
a2 4.67944748234004E-6
b2 13.236089621059
c2 -7474.57974538798
d2 963214.59538852
a3 1.04462488285875E-6
c3 -2496.32779108848,
谢谢!请问大神代码应该怎样写