function U03_test_function_handle_em_mog
%U03_TEST_FUNCTION_HANDLE_EM_MOG           Test function handling of em_mog
%
% This example shows how function handling works. The function simple_prog
% is passed to your function with @simple_prog . You can call it using
% feval, for example in your function (where the parameter is called
% prog_fun):
% 
% feval(prog_fun, X, mu, sigma)
%
%
%usage
%  U03_test_function_handle_em_mog
%
%author
%  saputra@cs.tu-berlin.de

% generate data set
mu_1 = [-4; 0];
mu_2 = [4; 0];
mu_3 = [0; sqrt(48)];
ns = 50;
X = [(randn(2, ns) + repmat(mu_1, 1, ns)) (randn(2, ns) + repmat(mu_2, 1, ns)) (randn(2, ns) + repmat(mu_3, 1, ns))];

em_mog(X, 3, 100, 0, @simple_prog);

function simple_prog(X, mu, sigma)

fprintf('mu_1 = [%f; %f], mu_2 = [%f; %f], mu_3 = [%f;%f]\n', mu(1, 1), mu(2, 1), mu(1, 2), mu(2, 2), mu(1, 3), mu(2, 3));
