登录论坛

查看完整版本 : 有一个算法不知道怎么写,报错,请大虾帮看看,谢谢!


basicx
2008-10-19, 19:09
>> f=@(x)('(60000+4x)./(5200+x)');
>> ezplot(f);
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.

Error in ==> specgraph\private\ezplotfeval>applyfun at 81
z(i) = feval(f,x(i));

Error in ==> specgraph\private\ezplotfeval at 68
z = applyfun(x);

Error in ==> ezplot>ezplot1 at 433
[y,f,loopflag] = ezplotfeval(f,x);

Error in ==> ezplot at 140
[hp,cax] = ezplot1(cax,f{1},vars,labels,args{:});

meteora1005
2008-10-19, 21:50
呵呵,你定义匿名函数f时错了,应该这样:
f=@(x)((60000+4*x)./(5200+x));
不用加单引号,4和x间要加乘号