MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   Mathematica论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=34)
-   -   [求助]数据拟合参数的运算问题 (https://www.labfans.com/bbs/showthread.php?t=5628)

leonsmith 2008-12-03 16:32

[求助]数据拟合参数的运算问题
 
给定一组(x,y)的数据如下:
(1,109,78),(2,80,35),(3,58.81),(4,43.04),(6,23.05),(8,12.35),(10,6.61)。
将其拟合成y=a*exp(-b*x)的形式[其中a,b为参数],输出此解析式,再输出参数c=a+b的值。

问题:
可以正常输出y=f(x)的函数解析式[能算出a,b],但输出参数c时只显示“c=a+b”而不是“c=×××”,为什么无法输出c的数值??恳请各位大侠解答!多谢了!
(如能给出输出c值的代码最好):lovely:
[PS:我是新手]

jAc 2009-01-10 18:53

回复: [求助]数据拟合参数的运算问题
 
In[1]:=
data = {{1, 109.78}, {2, 80.35}, {3, 58.81}, {4, 43.04}, {6,
23.05}, {8, 12.35}, {10, 6.61}};
{a, b} = {a, b} /. FindFit[data, a*Exp[-b*x], {a, b}, x]
func = a*Exp[-b*x]
c = a + b

Out[62]= {150., 0.31213}

Out[63]= 150. \[ExponentialE]^(-0.31213 x)

Out[64]= 150.312


所有时间均为北京时间。现在的时间是 11:32

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.