TA的每日心情 | 郁闷 2021-5-6 11:24 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到 累计签到:1 天 连续签到:1 天
|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
中括号的含义?
$ `7 O! m) \3 T7 {% p5 h9 m1 Gfunction quickplot(fun,xlim)
: m, H. Z5 X/ emsg=nargchk(2,2,nargin);
6 G9 E1 b6 y/ O4 m2 X% d: n+ I cerror(msg);' Z7 U- [" T! N" ?
if (size(xlim,1)==1 & size(xlim,2)==2) | (size(xlim,2)==1 & size(xlim,1)==2)" Z6 z4 ^$ B6 e+ h
n_steps=100;
0 X) t0 d2 Q) f( j) t step_size=(xlim(2)-xlim(1))/n_steps;3 P9 b2 v8 Y7 j( m) H8 u' P$ Z
x=xlim(1):step_size:xlim(2);, A* Z$ u0 f. i& o/ c; p k
y=feval(fun,x);
; r7 a6 ?5 e3 s/ P3 Z plot(x,y);
: r) h2 ]! i! X! o% e title(['\bfPlot of function' fun '(x)']);9 u( w! R- B1 |! `
xlabel('\bfx');
7 v& a P; ~: A. W ylabel(['\bf' fun '(x)']);3 Q: Q6 F6 t- }, Y+ K0 `! @
else$ @ f4 E: D9 |; U
error('Incorrect number of elements in xlim.');
1 c8 _* i* ^5 P+ J+ ]# S8 h$ Y1 ]8 R: iend
- z6 c- d5 @* A2 k4 t# x* @7 o, f, Q5 a& Q6 k$ G* o+ q
这个函数中,title(['\bfPlot of function' fun '(x)']);和ylabel(['\bf' fun '(x)']);这两句,为何要加中括号?不加中括号会出错! |
|