mathematica最小二乘法曲线拟合问题x = Table[100 + 10*i, {i, 0, 9}];y = {45, 51, 54, 61, 66, 70, 74, 78, 85, 89};xy = Table[{x[[i]], y[[i]]}, {i, 1, 10}]ListPlot[xy, PlotStyle -> PointSize[0.015]]q[a_, b_] := Sum[(b + ax[[i]] - y[[i]])^2, {i
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/30 02:15:26
![mathematica最小二乘法曲线拟合问题x = Table[100 + 10*i, {i, 0, 9}];y = {45, 51, 54, 61, 66, 70, 74, 78, 85, 89};xy = Table[{x[[i]], y[[i]]}, {i, 1, 10}]ListPlot[xy, PlotStyle -> PointSize[0.015]]q[a_, b_] := Sum[(b + ax[[i]] - y[[i]])^2, {i](/uploads/image/z/11505295-55-5.jpg?t=mathematica%E6%9C%80%E5%B0%8F%E4%BA%8C%E4%B9%98%E6%B3%95%E6%9B%B2%E7%BA%BF%E6%8B%9F%E5%90%88%E9%97%AE%E9%A2%98x+%3D+Table%5B100+%2B+10%2Ai%2C+%7Bi%2C+0%2C+9%7D%5D%3By+%3D+%7B45%2C+51%2C+54%2C+61%2C+66%2C+70%2C+74%2C+78%2C+85%2C+89%7D%3Bxy+%3D+Table%5B%7Bx%5B%5Bi%5D%5D%2C+y%5B%5Bi%5D%5D%7D%2C+%7Bi%2C+1%2C+10%7D%5DListPlot%5Bxy%2C+PlotStyle+-%3E+PointSize%5B0.015%5D%5Dq%5Ba_%2C+b_%5D+%3A%3D+Sum%5B%28b+%2B+ax%5B%5Bi%5D%5D+-+y%5B%5Bi%5D%5D%29%5E2%2C+%7Bi)
mathematica最小二乘法曲线拟合问题x = Table[100 + 10*i, {i, 0, 9}];y = {45, 51, 54, 61, 66, 70, 74, 78, 85, 89};xy = Table[{x[[i]], y[[i]]}, {i, 1, 10}]ListPlot[xy, PlotStyle -> PointSize[0.015]]q[a_, b_] := Sum[(b + ax[[i]] - y[[i]])^2, {i
mathematica最小二乘法曲线拟合问题
x = Table[100 + 10*i, {i, 0, 9}];
y = {45, 51, 54, 61, 66, 70, 74, 78, 85, 89};
xy = Table[{x[[i]], y[[i]]}, {i, 1, 10}]
ListPlot[xy, PlotStyle -> PointSize[0.015]]
q[a_, b_] := Sum[(b + ax[[i]] - y[[i]])^2, {i, 1, 10}]
Solve[{D[q[a, b], a] == 0, D[q[a, b], b] == 0}, {a, b}]
按理说应该可以解出来a,b,为什么出现了这个:
“Part::partd: 部分指定 ax[[1]] 比对象深度更长. >>
Part::partd: 部分指定 ax[[2]] 比对象深度更长. >>
Part::partd: 部分指定 ax[[3]] 比对象深度更长. >>
General::stop: 在本次计算中,Part::partd 的进一步输出将被抑制. >>
Solve::svars: 方程可能无法给出所有 "solve" 变量的解. >>
哪里出了问题
mathematica最小二乘法曲线拟合问题x = Table[100 + 10*i, {i, 0, 9}];y = {45, 51, 54, 61, 66, 70, 74, 78, 85, 89};xy = Table[{x[[i]], y[[i]]}, {i, 1, 10}]ListPlot[xy, PlotStyle -> PointSize[0.015]]q[a_, b_] := Sum[(b + ax[[i]] - y[[i]])^2, {i
ax中加空格