TA的每日心情 | 郁闷 2021-5-6 11:24 |
|---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到 累计签到:1 天 连续签到:1 天
|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
中括号的含义?
% c' f8 V, ^ x# Z, sfunction quickplot(fun,xlim)
( V0 b$ |4 G/ @ S: N8 ^: ~msg=nargchk(2,2,nargin);7 v) @5 I' s7 }9 n8 s
error(msg);
! W$ o+ R/ A" A( Z/ Pif (size(xlim,1)==1 & size(xlim,2)==2) | (size(xlim,2)==1 & size(xlim,1)==2)4 i1 Y4 [( F, S( q5 c* [
n_steps=100;) X9 z3 D! z2 w$ H& C+ [, v* s
step_size=(xlim(2)-xlim(1))/n_steps;
3 { E( I- a' q2 p x=xlim(1):step_size:xlim(2);
6 B2 [( q, |- r( q, { y=feval(fun,x);
6 f7 W$ O6 l+ Z+ i) X7 Z1 F; r plot(x,y);: v6 r) Q! ~& Y' C4 P- C& o K1 H
title(['\bfPlot of function' fun '(x)']);
# @- y, E+ W2 y, d! j xlabel('\bfx');8 D/ l7 k3 S9 V7 B& z# i
ylabel(['\bf' fun '(x)']);
# T* y" E; }% B9 s/ Ielse
- H6 Y: s. t: v2 a- d9 \+ O6 S error('Incorrect number of elements in xlim.');
5 t% X- K1 d. W0 B' |4 _- H% Uend' ?* u; M% e Q" B# z( ~7 b$ T
; x/ X4 G) u' G7 D9 i3 z0 s
这个函数中,title(['\bfPlot of function' fun '(x)']);和ylabel(['\bf' fun '(x)']);这两句,为何要加中括号?不加中括号会出错! |
|