gt93 发表于 2013-12-19 23:20

第一次出现怪事了

clear,clc
syms x f y
K=100;f=0;y=0;
for i=0:1:K
    j=1-0.01*i;
    f=x*(1-x)^i*j;
    y=y+f;
end
x=0:0.01:1;
plot(x,y,'r');Error using plot
Conversion to double from sym is not possible.

Error in sky (line 11)
plot(x,y,'r');

袁海亮 发表于 2013-12-20 10:40

涛哥来了!plot()后面的标点去掉试试

gt93 发表于 2013-12-20 11:10

袁海亮 发表于 2013-12-20 10:40 static/image/common/back.gif
涛哥来了!plot()后面的标点去掉试试

不行,我重新写了一下代码。如下:clear,clc
K=100;y=0;
for i=0:1:K
    j=1-0.01*i;
    syms x
    f=x*(1-x).^i*j;
    y=y+f;
end
x=0:(1/K):1;
subplot(1,2,1)
ezplot(y,x)
dy=diff(y);
subplot(1,2,2)
ezplot(dy,x)已经运行正常了。但是怎么标记第一张图像中x=0.1和x=0.2那一点,以及第二张图像中y=1那个点呢?
页: [1]
查看完整版本: 第一次出现怪事了