TA的每日心情 | 郁闷 2021-5-6 11:24 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到 累计签到:1 天 连续签到:1 天
|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
中括号的含义?
: X Q" U, y* ?' C+ U4 Ufunction quickplot(fun,xlim)3 C6 n7 ]# H O! n! d
msg=nargchk(2,2,nargin);
7 P/ R' ~2 B! p) P8 T/ eerror(msg);
! z2 X& S3 B. j9 b$ t9 gif (size(xlim,1)==1 & size(xlim,2)==2) | (size(xlim,2)==1 & size(xlim,1)==2)
3 Q Q" J) u: h! O0 ` n_steps=100;. `, T/ D+ }$ k
step_size=(xlim(2)-xlim(1))/n_steps;
) b9 Z5 O& X% k; m: P4 e4 k9 a7 R4 U x=xlim(1):step_size:xlim(2);
1 Q% J6 t5 W/ e2 E9 l; M y=feval(fun,x);
) \6 c1 }: Y% q plot(x,y);% @$ l+ f& r4 D$ y2 P6 c! e, X2 m! a
title(['\bfPlot of function' fun '(x)']);
" g l, T7 i9 U, {, Y xlabel('\bfx');! h+ ~! l- N1 [. a
ylabel(['\bf' fun '(x)']);
# S& l: k( v2 q& g8 qelse8 g( k0 f* ^* G, |% F- ~7 i3 S2 `
error('Incorrect number of elements in xlim.');
9 V: l' n. R4 L$ L& I' m8 Cend" O: I/ }8 |2 Z6 q! l
2 @& L: H' w- T' R+ @9 Q这个函数中,title(['\bfPlot of function' fun '(x)']);和ylabel(['\bf' fun '(x)']);这两句,为何要加中括号?不加中括号会出错! |
|