Attachment 'U03_test_function_handle_em_mog.m'
Download 1 function U03_test_function_handle_em_mog
2 %U03_TEST_FUNCTION_HANDLE_EM_MOG Test function handling of em_mog
3 %
4 % This example shows how function handling works. The function simple_prog
5 % is passed to your function with @simple_prog . You can call it using
6 % feval, for example in your function (where the parameter is called
7 % prog_fun):
8 %
9 % feval(prog_fun, X, mu, sigma)
10 %
11 %
12 %usage
13 % U03_test_function_handle_em_mog
14 %
15 %author
16 % saputra@cs.tu-berlin.de
17
18 % generate data set
19 mu_1 = [-4; 0];
20 mu_2 = [4; 0];
21 mu_3 = [0; sqrt(48)];
22 ns = 50;
23 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))];
24
25 em_mog(X, 3, 100, 0, @simple_prog);
26
27 function simple_prog(X, mu, sigma)
28
29 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));
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.