-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathEx03_testICAmethods.m
More file actions
48 lines (44 loc) · 1.5 KB
/
Ex03_testICAmethods.m
File metadata and controls
48 lines (44 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Independent component analysis using classical methods
%
% BMI500 Course
% Lecture: An Introduction to Blind Source Separation and Independent Component Analysis
% By: R. Sameni
% Department of Biomedical Informatics, Emory University, Atlanta, GA, USA
% Fall 2020
%
% Dependency: The open-source electrophysiological toolbox (OSET):
% https://github.com/alphanumericslab/OSET.git
% OR
% https://gitlab.com/rsameni/OSET.git
%
clc
clear
close all
example = 3;
switch example
case 1 % A sample EEG from the OSET package
load EEGdata textdata data % Load a sample EEG signal
fs = 250;
x = data'; % make the data in (channels x samples) format
% Check the channel names
disp(textdata)
case 2 % A sample ECG from the OSET package
load SampleECG2 data % Load a sample ECG signal
fs = 1000;
x = data(:, 2:end)'; % make the data in (channels x samples) format
x = x - LPFilter(x, 1.0/fs); % remove the lowpass baseline
case 3 % A synthetic signal
fs = 500;
len = round(3.0*fs);
s1 = sin(2*pi*7.0/fs * (1 : len));
s2 = 2*sin(2*pi*1.3/fs * (1 : len) + pi/7);
period = 76.0;
s3 = (mod(1:len, 76.0) - period/2)/(period/2);
A = rand(3);
noise = 0.01*randn(3, len);
x = A * [s1 ; s2 ; s3] + noise;
otherwise
error('unknown example');
end
N = size(x, 1); % The number of channels
T = size(x, 2); % The number of samples per channel