wICA(data,varargin)

uses stationary wavelets to enhance independent components analysis artifact removal
1.2K Downloads
Updated 15 Feb 2016

View License

%--------------- function [wIC,A,W] = wICA(data,varargin) -----------------
%
% Performs ICA on data matrix (row vector) and subsequent wavelet
% thresholding to remove low-amplitude activity from the computed ICs.
% This is useful for extracting artifact-only ICs in EEG (for example), and
% then subtracting the artifact-reconstruction from the original data.
%
% Code is interpretation/implementation of:
% Castellanos & Makarov, J. Neurosci. Method. 2006
%
% >>> INPUTS >>>
% Required:
% data = data matrix in row format
% Optional:
% type = "fastica" or "radical"...two different ICA algorithms based on
% entropy. "fastica" (default) is parametric, "radical" is nonparametric.
% mult = threshold multiplier...multiplies the computed threshold from
% "ddencmp" by this number. Higher thresh multipliers = less
% "background" (or low amp. signal) is kept in the wICs.
% plotting = 1 or 0. If 1, plots wIC vs. non-wavelet thresholded ICs
% Fs = sampling rate, (for plotting...default = 1);
% L = level set for stationary wavelet transform. Higher levels give
% better frequency resolution, but less temporal resolution.
% Default = 5
% wavename = wavelet family to use. type "wavenames" to see a list of
% possible wavelets. (default = "coif5");
%
% <<< OUTPUTS <<<
% wIC = wavelet-thresholded ICs
% A = mixing matrix (inv(W)) (optional)
% W = demixing matrix (inv(A)) (optional)
% IC = non-wavelet ICs (optional)
%
% * you can reconstruct the artifact-only signals as:
% artifacts = A*wIC;
% - upon reconstruction, you can then subtract the artifacts from your
% original data set to remove artifacts, for instance.
%
% Example:
% n = rand(10,1000);
% a = [zeros(1,400),[.5,.8,1,2,2.4,2.5,3.5,5,6.3,6,4,3.2,3,1.7,1,-.6,-2.2,-4,-3.6,-3,-1,0],zeros(1,578)];
% data = n + linspace(0,2,10)'*a;
% [wIC,A] = wICA(data,[],5,1);
% ahat = A*wIC;
% nhat = data-ahat;
% err = sum(sqrt((nhat-n).^2));
%
% By JMS, 11/10/2015
%---------------------------------------------------------------------------------------

Cite As

Jordan Sorokin (2024). wICA(data,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/55413-wica-data-varargin), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0