如何进行多元拟合?
看maple里的帮助没有这方面的例子,只是提了一下,请大家给个例子,谢谢,两个变量就行,用statistics包里的Fit命令 用Maple时有两招必用,一是看自带的帮助系统,还有一个比较好的资源系统:
http://www.maplesoft.com/applications/
输入fit,可以找到很多曲线拟合的例子。 谢谢楼上的回答,在帮助里没有找到多元拟合,最多只有一元的,
资源系统里面也没有的 多元的不多见,1stopt应该可以。 这个已经搞定了,
多谢斑竹 请问你是如何做的啊?能详细介绍一下吗? :D http://www.cca-es.com/bbs/dispbbs.asp?boardID=6&ID=21664&page=3 Note that a model function can be nonlinear in the independent variables but linear in the model parameters. 用matlab做拟合,更快一些
上面的帖子看不到了,代码如下
本帖最后由 feiyuzhen 于 2012-1-6 15:10 编辑restart;
with(stats);
with(fit);
with(statplots);
with(plots);
datax := ;
datay := map(proc (x) options operator, arrow; evalf(sin((1/100)*x/Pi)+(1/100)*(rand(30))(), 4) end proc, datax);
p1 := scatterplot(datax, datay);
display(p1);
leastsquare[, y = a0+a1*x+a2*x^2, {a0, a1, a2}]();
f := rhs(%);
p2 := plot(f, x = 0 .. 100);
display(p1, p2);
datax1 := ;
datax2 := ;
datay1 := ;
leastsquare[, y = a1*x1+a2*x2, {a1, a2}]();
with(Statistics);
f1 := Fit(a+b*x+c*x^2, datax, datay, x);
f := Fit(a0+a1*sin((1/10)*x)+a2*sin((1/20)*x)+a3*sin((1/40)*x), datax, datay, x);
p3 := plot(f, x = 0 .. 100);
display(p1, p3);
with(linalg);
datax1 := ;
datax2 := ;
datax12 := zip(proc (x1, x2) options operator, arrow; end proc, datax1, datax2);
datay := zip(proc (x1, x2) options operator, arrow; x1+2*x2+cos(x1*x2)+(1/1000)*(rand(100))() end proc, datax1, datax2);
whattype(datay);
nops(datay);
f4 := Fit(a1*x1+a2*x2+a3*cos(x1*x2)+a4*x1*x2, Matrix(datax12), datay, );
页:
[1]