function val = min_std_dev_fn(wj, pj,qj) % MIN_STD_DEV_FN - Returns the standard deviation of the horse track betting problem % % wj has N-1 elments the last element wj(N) is computed from the previous N-1 i.e. = 1 - sum( wj ) % % 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. % %----- % "create" the probabilty we must assign to the last horse: wj = [ wj(:); 1-sum(wj) ]; wj = wj(:)'; % compute the mean % m = sum( pj .* wj .* ( qj + 1 ) ) - 1; % compute the standard deviation: % val = sqrt( sum( pj .* ( wj .* ( qj + 1 ) - 1 - m ).^2 ) );