TA的每日心情 | 郁闷 2021-5-6 11:24 |
|---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到 累计签到:1 天 连续签到:1 天
|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
中括号的含义?
- \8 ?$ K6 j7 J. wfunction quickplot(fun,xlim)0 t' G4 X/ J; t! \* a( |: k$ b
msg=nargchk(2,2,nargin);
2 z5 R, J: B3 q* J/ [* |& perror(msg);
0 s% D" D; Q. n% Tif (size(xlim,1)==1 & size(xlim,2)==2) | (size(xlim,2)==1 & size(xlim,1)==2)
c# L5 F. A. L9 f3 {& i n_steps=100;& V# }2 @# }- i. `. \( s. n
step_size=(xlim(2)-xlim(1))/n_steps;
1 |; G( C4 ], C0 }% x2 m x=xlim(1):step_size:xlim(2);& t7 w% [) Y; a
y=feval(fun,x);# \* a) z* z$ Y
plot(x,y);, O/ F+ `; t$ ^
title(['\bfPlot of function' fun '(x)']);
( \6 G6 f8 J/ K: y+ @: Q* O xlabel('\bfx');9 w [9 C: M; u
ylabel(['\bf' fun '(x)']);
- J3 o. A$ l& g9 L8 k Eelse$ L9 {6 Z, P0 H; `) J
error('Incorrect number of elements in xlim.');
( A7 w1 j! T8 \: f# Kend# \; ^( b4 ]2 t3 V) I" {
S9 B j, E. Y& g% P; Y这个函数中,title(['\bfPlot of function' fun '(x)']);和ylabel(['\bf' fun '(x)']);这两句,为何要加中括号?不加中括号会出错! |
|