syms r x;
f = symfun(r*x*(1-x), x)
r = 3
plot(f,x)
plot(x,x)
请有人帮忙指出我出错的地方。
1 个答案:
答案 0 :(得分:4)
错误非常明确:将数字参数传递给plot。你给它带来了象征性的功能。只需使用
r = 3;
x = 0:0.1:10; %// set some x
f = (r.*x.*(1-x)); %// dots make the multiplication element-wise
figure; %// opens figure
hold on %// plots multiple things in one figure
plot(f,x)
plot(x,x,'r') %// produces a red plot