% % Written by: % -- % John L. Weatherwax 2006-12-31 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; close all; clear; qj = [ 5 6 1 1 2 2 2 2 ]; pj = [ 0.2 0.2 0.1 0.1 0.1 0.1 0.1 0.1 ]; % form the required product: % [m,mi] = max( pj .* ( qj + 1 ) ); % number 2 is the winner % wj = zeros(1,length(qj)); wj(2) = 1; % compute the mean and standard deviation: % m = sum( pj .* wj .* ( qj + 1 ) ) - 1 uncer = sqrt( sum( pj .* ( wj .* ( qj + 1 ) - 1 - m ).^2 ) )