| 查看: 706 | 回复: 0 | ||
| 【悬赏金币】回答本帖问题,作者月璎珞将赠送您 300 个金币 | ||
月璎珞至尊木虫 (职业作家)
|
[求助]
求带参数约束条件的数据拟合C语言代码
|
|
|
已知两列数据:X=[x1, x2, ……, xn],Y=[y1, y2, ……, yn]; 拟合函数y=a*x^b+c拟合,其中a, b, c是拟合参数,且参数b必须满足约束条件:b∈[m, n]. 我能用matlab实现,但现在需要不安装matlab,用C语言运行,跪求大神帮忙! ![]() ![]() 附matlab算例: x=[332 414 507 653 739 888 1060 1268 1607 1920 2438 2886 3485]; y=[4.7 5.1 5.5 6 6.3 6.7 7.1 7.5 8 8.4 8.8 9.1 9.4]-4.7; x=x'; % transfer Row matrix to Column matrix; y=y'; p1=fittype('a*x^b+c','dependent',{'y'},'independent',{'x'},'coefficients',{'a', 'b', 'c'}); % Fitting function opts = fitoptions( 'Method', 'NonLinearLeastSquares' ); opts.Lower = [0 0.3 -20]; opts.StartPoint = [1, 0.4,-0.25]; opts.Upper = [200 0.49 0]; f1=fit(x,y,p1,opts); res1=[coeffvalues(f1)] 不用安装matlab软件,怎么把上面的程序用C语言实现? |
» 猜你喜欢
不要再数国自然申请书的 filecode 的分隔符个数了
已经有21人回复
投英文期刊如何查重
已经有5人回复
伯胺上甲基求助
已经有7人回复
生命口面上会评结束了吗大家有知道结果吗?现在还没有结果正常不?
已经有8人回复
跨出版社商投稿
已经有5人回复
5个%2F,非固定段22个字母
已经有7人回复
生命口C13面上会评时间
已经有10人回复
生生命学部会评
已经有4人回复
H口,面上,时间戳7月7日。
已经有3人回复
小木虫没落了,除了祈祷帖子,几乎看不到有价值的帖子
已经有14人回复












回复此楼