Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wolfram mathematica 常规::ivar:。。。在Mathematica中不是有效的变量错误_Wolfram Mathematica - Fatal编程技术网

Wolfram mathematica 常规::ivar:。。。在Mathematica中不是有效的变量错误

Wolfram mathematica 常规::ivar:。。。在Mathematica中不是有效的变量错误,wolfram-mathematica,Wolfram Mathematica,我按顺序执行了这些命令,得到了3个错误,它们是“general::ivar:…不是变量”,然后general::stop:在计算过程中,general::ivar的进一步输出将被抑制。 将显示ListPlot,但不显示拟合线。有人能解释一下我代码中的错误在哪里,以及这个错误的含义吗 编辑:还生成了消息 xCoordinates = {45, 40, 35, 30, 25, 20, 15, 10, 5, 0} yCoordinates = {0.6, 1.3, 1.5, 2.4, 5, 5.2,

我按顺序执行了这些命令,得到了3个错误,它们是“general::ivar:…不是变量”,然后general::stop:在计算过程中,general::ivar的进一步输出将被抑制。 将显示ListPlot,但不显示拟合线。有人能解释一下我代码中的错误在哪里,以及这个错误的含义吗

编辑:还生成了消息

xCoordinates = {45, 40, 35, 30, 25, 20, 15, 10, 5, 0}
yCoordinates = {0.6, 1.3, 1.5, 2.4, 5, 5.2, 5.3, 6, 6.4, 6.6}
plotData = Transpose@{xCoordinates, yCoordinates}
Show[ListPlot[plotData], Plot[Fit[plotData, {1, x}, x], {x, 0, 45}]]


这些是什么意思?

请参阅上的详细信息部分

“绘图具有属性
HoldAll
,仅在将特定数值指定给x后才计算f。”

要解决此问题,请在
绘图
功能之外评估拟合

Coordinate Skeleton[10] should be a pair of numbers, or a Scaled or Offset form.

来自文档:“是一个属性,指定函数的所有参数都以未计算的形式进行维护。”这导致
Plot
报告各种无效变量()错误。或者,使用Evaluate:
Show[ListPlot[plotData],Plot[Evaluate@Fit[plotData,{1,x},x],{x,0,45}]
Coordinate Skeleton[10] should be a pair of numbers, or a Scaled or Offset form.
xCoordinates = {45, 40, 35, 30, 25, 20, 15, 10, 5, 0};
yCoordinates = {0.6, 1.3, 1.5, 2.4, 5, 5.2, 5.3, 6, 6.4, 6.6};
plotData = Transpose@{xCoordinates, yCoordinates};
fit = Fit[plotData, {1, x}, x];
Show[ListPlot[plotData], Plot[fit, {x, 0, 45}]]