我试图生成以下方程式的蜘蛛网图 xn + 1 = xn * e ^ a(1-xn / 1000),x0 = 200并且a是一个常数 但是以某种方式我无法绘制原始函数并且y =(x) 以下是我在scilab中的代码
x0 = 200
n = 20
a = 2
deff("y = F(x)", "y = x*%e^(a*(1-x/1000))")
cw = [x0 0];
x = x0;
for i = 1:n
newx = F(x);
cw = [cw;x newx; newx newx];
x = newx
end
for x = x0;
y1 = x*%e^(a*(1-x/1000))
y2 = x
end
plot2d(cw(:,1),cw(:,2),4)
plot2d(x, y1, 5)
plot2d(x, y2, 6)
title("Cobweb Diagram")
xlabel("x(n)")
ylabel("x(n+1)")