Matching pursuit for 1D signals

버전 1.3.0.0 (4.82 KB) 작성자: Patrick Mineault
Performs Matching Pursuit on 1d (temporal) signals with custom basis
다운로드 수: 4K
업데이트 날짜: 2011/9/22

라이선스 보기

Performs matching pursuit (MP) on a one-dimensional (temporal) signal y with a custom basis B.

Matching pursuit (Mallat and Zhang 1993) is a greedy algorithm to obtain a sparse representation of a signal y in terms of a weighted sum (w) of dictionary elements D (y ~ Dw). Sparse means that most elements are equal to 0 (nnz(w) << length(y)). Such a sparse representation is useful in many different scenarios: to obtain time-frequency spectrograms, denoise signals, compress signals, etc.

For temporal signals, it's natural to use a dictionary of elements D composed of basis elements B shifted to every possible time point. In this case, the weights form of a convolutional or shift-invariant sparse code in a highly overcomplete dictionary:

y ~ r
r = sum_i conv(ws(:,i),B(:,i),'same')
and nnz(ws(:)) << length(y)

If B is equal to a bunch of windowed sinusoids, this representation forms a time-frequency decomposition of the signal. One application of this decomposition is EEG/MEG and LFP analysis (http://www.scholarpedia.org/article/Matching_pursuit).

Another application is expressing a sound signal as a sum of gammatone-like functions (Smith and Lewicki 2006) or chords (Blumensath and Davies 2006).

This implementation should be efficient enough for practical use. It precomputes all convolutions using the FFT and does not perform convolutions in the main loop. It uses a 3-level tree to search for the maximum correlation, and each iteration is O(sqrt(length(y))).

Function signature:
[ws,r] = temporalMP(y,B,nonnegative,maxiter,maxr2)

Arguments:
y: a mx1 signal
B: an nxp basis. n is the length of each basis function and p is
the number of such basis functions
nonnegative (optional): if true, uses a variant of MP where ws are
forced to be >= 0 (default false)
maxiter and maxr2 (optional): specifies when to stop iterating,
when #iterations > maxiter or the R^2 between y and r
is greater than maxr, whichever comes first (defaults: maxiter:
10000, maxr2: .999)

Returns:
ws: an mxn matrix of weights
r: the approximation of y in terms of the weights and basis
functions

Example use:
sig = load('gong.mat'); %included in matlab

%Build a basis of Gabors
rg = (-500:500)';
sigmas = exp(log(2):.3:log(200));
gabors = exp(-.5*(rg.^2)*sigmas.^(-2)).*cos(rg*sigmas.^(-1)*2*pi*2);

%Express signal as a sparse sum of Gabors
[ws,r] = temporalMP(sig.y,gabors,false,5000);

%See TryTemporalMP.m for more examples

인용 양식

Patrick Mineault (2024). Matching pursuit for 1D signals (https://www.mathworks.com/matlabcentral/fileexchange/32426-matching-pursuit-for-1d-signals), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Correlation and Convolution에 대해 자세히 알아보기
도움

받음: FFT-based convolution

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.3.0.0

Added "deadzone" feature

1.1.0.0

Corrected bug with edges, increase efficiency by adding a level to the current maximum correlation search tree

1.0.0.0