matlab求和问题!
发布网友
发布时间:2022-09-09 22:04
我来回答
共1个回答
热心网友
时间:2024-03-13 14:57
具体什么问题呢?
matlab 帮助文档如下
help sum
SUM Sum of elements.
S = SUM(X) is the sum of the elements of the vector X. If
X is a matrix, S is a row vector with the sum over each
column. For N-D arrays, SUM(X) operates along the first
non-singleton dimension.
If X is floating point, that is double or single, S is
accumulated natively, that is in the same class as X,
and S has the same class as X. If X is not floating point,
S is accumulated in double and S has class double.
S = SUM(X,DIM) sums along the dimension DIM.
S = SUM(X,'double') and S = SUM(X,DIM,'double') accumulate
S in double and S has class double, even if X is single.
S = SUM(X,'native') and S = SUM(X,DIM,'native') accumulate
S natively and S has the same class as X.
Examples:
If X = [0 1 2
3 4 5]
then sum(X,1) is [3 5 7] and sum(X,2) is [ 3
12];
If X = int8(1:20) then sum(X) accumulates in double and the
result is double(210) while sum(X,'native') accumulates in
int8, but overflows and saturates to int8(127).
See also prod, cumsum, diff, accumarray, isfloat.
Overloaded methods:
timeseries/sum
codistributed/sum
umat/sum
ndlft/sum
Reference page in Help browser
doc sum