prod.m

来自「GloptiPoly 3: moments, optimization and 」· M 代码 · 共 24 行

M
24
字号
function y = prod(x)% @MPOL/PROD - Product of elements%% For vectors, PROD(X) is the product of the elements of X.% For matrices, PROD(X) is a row vector with the product over each column.  % D. Henrion, August 3, 2004[nr,nc] = size(x);if min(nr,nc) == 1 y = x(1); for i = 2:max(nr,nc)  y = y*x(i); endelse y = x(1,:); for j = 1:nc  for i = 2:nr   y(j) = y(j)*x(i,j);  end endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?