⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 average.m

📁 一个matlab的将军模型
💻 M
字号:
function v_avg = average(V)

% Average value of a vertices object
%
% Syntax:
%   "A = average(vtcs)"
%
% Description:
%   "average(vtcs)" returns a column vector containing the average value
%   of the points represented by "vtcs" (i.e. find the average value of
%   each dimension of "vtcs").
%
% Examples:
%
%
%
%   "a = ["
%
%   "2 2 4 4"
%
%   "1 3 3 1"
%
%   "0 0 0 0];"
%
%   "vtcs = vertices(a);"
%
%   "A = average(vtcs)"
%
%
%
%   returns 
%
%
%
%   "A ="
%
%   "3"
%
%   "2"
%
%   "0"
%
%
%
% See Also:
%   vertices

N = length(V);
v_avg = V.list(:,1);
for k = 2:N
  v_avg = v_avg + V.list(:,k);
end
v_avg = v_avg/N;

⌨️ 快捷键说明

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