From 1a4e885a55c8041344c37a312f937a7421bb42e8 Mon Sep 17 00:00:00 2001 From: Zahara Wang Date: Fri, 30 Oct 2020 13:05:44 -0400 Subject: [PATCH] class notes --- Ex01_testPCA.m | 6 +++++- Ex02_testEigenAnalysisPowerMethod.m | 9 +++++++++ Ex03_testICAmethods.m | 11 +++++++++++ Ex04_testEOGArtifactRemoval.m | 1 + Ex05_testFetalECGExtraction.m | 1 + 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Ex01_testPCA.m b/Ex01_testPCA.m index 1181070..f55eb12 100644 --- a/Ex01_testPCA.m +++ b/Ex01_testPCA.m @@ -1,4 +1,5 @@ -% Principal component analysis +%Zahara Wang zahara.wang@emory.edu +%Principal component analysis % % BMI500 Course % Lecture: An Introduction to Blind Source Separation and Independent Component Analysis @@ -32,6 +33,9 @@ otherwise error('unknown example'); end +x_demeaned = x - mean(x,2)*ones(1,size(x,2)); +Cx = cov(x_demeaned'); +[V, D] = eig(Cx, 'vector'); N = size(x, 1); % The number of channels T = size(x, 2); % The number of samples per channel diff --git a/Ex02_testEigenAnalysisPowerMethod.m b/Ex02_testEigenAnalysisPowerMethod.m index f1d95be..c559595 100644 --- a/Ex02_testEigenAnalysisPowerMethod.m +++ b/Ex02_testEigenAnalysisPowerMethod.m @@ -1,3 +1,4 @@ +%Zahara Wang zahara.wang@emory.edu % The power method for eigenvalue decomposition % % BMI500 Course @@ -24,3 +25,11 @@ % Cx = x * x'; Cx = cov(x'); +[V,D] = eig(Cx) + +Itr = 100; + +v0 = rand(N,1); +v1 = EigenAnalysisPowerMethod(Cx, v0, Itr); +scale1 = (Cx*v1) ./v1; +lambda1 = mean(scale1); diff --git a/Ex03_testICAmethods.m b/Ex03_testICAmethods.m index af123be..4986429 100644 --- a/Ex03_testICAmethods.m +++ b/Ex03_testICAmethods.m @@ -1,3 +1,4 @@ +%Zahara Wang zahara.wang@emory.edu % Independent component analysis using classical methods % % BMI500 Course @@ -46,3 +47,13 @@ N = size(x, 1); % The number of channels T = size(x, 2); % The number of samples per channel +approach = "symm"; +g = "tanh"; +lastEigfastica = N; +numOfIC = N; +interactivePCA = 'off'; +[s_fastica, A_fastica, W_fastica] = fastica(x, 'approach', approach, ... + 'g', g, 'lastEig', lastEigfastica, 'numOfIC', numOfIC, ... + 'interactivePCA', interactivePCA); + +Cs = cov(s_fastica'); diff --git a/Ex04_testEOGArtifactRemoval.m b/Ex04_testEOGArtifactRemoval.m index b6c4122..9b485f7 100644 --- a/Ex04_testEOGArtifactRemoval.m +++ b/Ex04_testEOGArtifactRemoval.m @@ -1,3 +1,4 @@ +%Zahara Wang zahara.wang@emory.edu % Removing EOG artifacts from EEG signals % % BMI500 Course diff --git a/Ex05_testFetalECGExtraction.m b/Ex05_testFetalECGExtraction.m index 3ac2f31..5519f9c 100644 --- a/Ex05_testFetalECGExtraction.m +++ b/Ex05_testFetalECGExtraction.m @@ -1,3 +1,4 @@ +%Zahara Wang zahara.wang@emory.edu % Extracting fetal ECG signals using various ICA algorithms % % BMI500 Course