这次复制粘贴的代码,但是还是报错,没有k值
data = {{29.3, 42}, {44, 73.5}, {58.7, 116}, {73.3, 173}, {88,
248}, {102.7, 343}, {117.3, 464}};
model[x_] := 0.75 x + k x^2;
fit = FindFit[data, model[x], {k}, x];
Show[ListPlot[data], Plot[model[x] /. fit, {x, 0, 120}]]
FindFit::fdssnv: 没有变量的搜索指定 1/2 ((FindFit^({{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},{0,0},1))[{{29.3,42},{44,73.5},{58.7,116},{73.3,173},{88,248},{102.7,343},{117.3,464}},{0.,0},0]+0.75 (FindFit^({{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},{1,0},0))[{{29.3,42},{44,73.5},{58.7,116},{73.3,173},{88,248},{102.7,343},{117.3,464}},{0.,0},0]) 应该是由 1 至 4 个元素组成的列表.
ReplaceAll::reps: {FindFit[{{29.3,42},{44,73.5},{58.7,116},{73.3,173},{88,248},{102.7,343},{117.3,464}},0.00183857 +3.00475*10^-6 ((FindFit^({{<<2>>},{<<2>>},{<<2>>},{<<2>>},{<<2>>},{<<2>>},{<<2>>}},{0,0},1))[{{<<2>>},{<<2>>},{<<2>>},{<<2>>},{<<2>>},{<<2>>},{<<2>>}},{0.,0},0]+0.75 (FindFit^({<<7>>},{<<2>>},0))[{<<7>>},{<<2>>},0]),{1/2 (<<1>>+<<1>>)},0.00245143]} 既不是替换规则列表,也不是一个有效的分派表,因此无法用来替换.
General::stop: 在本次计算中,ReplaceAll::reps 的进一步输出将被抑制. |