Attachment 'sheet05.m'
Download 1 function sheet05
2
3 % generate some data
4 T = linspace(0, 10, 1000);
5 X1 = sin(pi*T);
6 X2 = 2*(T - floor(T)) - 1;
7 X3 = 0.1*randn(1, 1000);
8
9 X = [X1; X2; X3];
10
11 % plot the sources
12 figure(1)
13 plotsources(T, X)
14
15 % generate a random mixing matrix
16 A = randn(3, 3);
17 Y = A * X;
18
19 % plot the mixed sources
20 figure(2)
21 plotsources(T, Y);
22
23 % compute time-lagged
24 B = tdsep(Y, 5);
25
26 figure(3)
27 plotsources(T, B'*Y)
28
29 function plotsources(T, X)
30 N = size(X, 1);
31 for I = 1:N
32 subplot(N, 1, I)
33 plot(T, X(I, :))
34 end
35
36 % Compute the TDSEP estimate by diagonalizing both matrices
37 % simultaneously. Use matlabs EIG function for two matrices.
38 function B = tdsep(Y, T)
39 C0 = tdcov(Y, 0);
40 CT = tdcov(Y, T);
41 % ...
42
43 % Compute the time-lagged covariance matrices. Extract a "normal" and a
44 % lagged version of the signal and estimate the covariance matrix for
45 % both parts.
46 function C = tdcov(X, T)
47 % ...
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.