www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SpecifyWeightVectorExample.m

    %% Specify Variance Weight Vector
% Create a matrix and compute its variance according to a weight vector |w|.

% Copyright 2015 The MathWorks, Inc.

A = [5 -4 6; 2 3 9; -1 1 2];
w = [0.5 0.25 0.25];
var(A,w)