在 scilab 中绘制函数
Plotting a function in scilab
你能帮我吗,我正在尝试在 scilab 中绘制函数 y=1/x,
抛出我的图表不正确
x = [1:1:10]';
y = 1./x;
plot(x,y)
并向我抛出这些结果
y=
0.0025974
0.0051948
0.0077922
0.0103896
0.0129870
0.0155844
0.0181818
0.0207792
0.0233766
0.0259740
这个结果是错误的,代码也是如此,
感谢您的帮助:)
写
y = 1 ./ x;
而不是
y = 1./x;
来自documentation (重点是我的):
a ./ b is the matrix with entries a(i,j)/ b(i,j). If b is scalar (1x1 matrix) this operation is the same as a./b*ones(a). (Same convention if a is a scalar).
Remark that 123./b is interpreted as (123.)/b. In this cases dot is part of the number not of the operator.
你能帮我吗,我正在尝试在 scilab 中绘制函数 y=1/x, 抛出我的图表不正确
x = [1:1:10]';
y = 1./x;
plot(x,y)
并向我抛出这些结果
y=
0.0025974
0.0051948
0.0077922
0.0103896
0.0129870
0.0155844
0.0181818
0.0207792
0.0233766
0.0259740
这个结果是错误的,代码也是如此, 感谢您的帮助:)
写
y = 1 ./ x;
而不是
y = 1./x;
来自documentation (重点是我的):
a ./ b is the matrix with entries a(i,j)/ b(i,j). If b is scalar (1x1 matrix) this operation is the same as a./b*ones(a). (Same convention if a is a scalar).
Remark that 123./b is interpreted as (123.)/b. In this cases dot is part of the number not of the operator.