7. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
H1 列和註解說明文字 (1/2)
範例: 函式 vec_plus.m
function total = vec_plus(x,y)
% vec_plus Sum of two numbers or vectors.
% vec_plus(X,Y) computes X+Y and returns the result,
% where X and Y can be scalars or vectors.
% function's body starts here
total = x + y;
>> vec_plus(2,ones(2,1))
ans =
3
3
Hung-Yuan Fan (范洪源), Dep. of Math., NTNU, Taiwan Chap. 6, Computer Programming 7/52
8. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
H1 列和註解說明文字 (2/2)
>> help vec_plus
vec_plus Sum of two numbers or vectors.
vec_plus(X,Y) computes X+Y and returns the result,
where X and Y can be scalars or vectors.
>> lookfor sum
vec_plus - Sum of two numbers or vectors.
reciproc_sum - Function-valued tensor for 1/(xi_1 + ... + xi_d)
StatisticsByGroupMapReduceExample - Compute Summary Statistics by Group Using
MapReduce
summer - Shades of green and yellow colormap
uiresume - Resume execution of blocked MATLAB code.
.
.
.
Hung-Yuan Fan (范洪源), Dep. of Math., NTNU, Taiwan Chap. 6, Computer Programming 8/52