function [v, avg] = variance(x)
%VARIANCE Variance of three values
%   [v, avg] = variance(x) returns the variance v and average avg
%   of the three values in x.

avg = (x(1) + x(2) + x(3)) / 3;
v = (x(1) - avg)^2 + (x(2) - avg)^2 + (x(3) - avg)^2;
v = v / 2;

end
