中括号的含义?
中括号的含义?function quickplot(fun,xlim)
msg=nargchk(2,2,nargin);
error(msg);
if (size(xlim,1)==1 & size(xlim,2)==2) | (size(xlim,2)==1 & size(xlim,1)==2)
n_steps=100;
step_size=(xlim(2)-xlim(1))/n_steps;
x=xlim(1):step_size:xlim(2);
y=feval(fun,x);
plot(x,y);
title(['\bfPlot of function' fun '(x)']);
xlabel('\bfx');
ylabel(['\bf' fun '(x)']);
else
error('Incorrect number of elements in xlim.');
end
这个函数中,title(['\bfPlot of function' fun '(x)']);和ylabel(['\bf' fun '(x)']);这两句,为何要加中括号?不加中括号会出错! 语法规则决定的,就好比是c为啥总从main入口 等于没说哦 :shutup:支持~
页:
[1]
