Line filter: Difference between revisions
Jump to navigation
Jump to search
imported>Neal |
imported>Scott |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Spectral | Spectral filtering via convolution and deconvolution. | ||
===Synopsis=== | ===Synopsis=== | ||
Line 30: | Line 30: | ||
* '''conv''': [ {'convolve'} | 'deconvolve' ] Governs the algorithm and tells it to convolve with the point source function given in (options.psf) or deconvolve. If 'deconvolve', then (options.reg) is used. | * '''conv''': [ {'convolve'} | 'deconvolve' ] Governs the algorithm and tells it to convolve with the point source function given in (options.psf) or deconvolve. If 'deconvolve', then (options.reg) is used. | ||
* '''reg''': {1e-6} regularization parameter (this parameter is used for ridging in the deconvolution algorithm). | * '''reg''': {1e-6} regularization parameter (this parameter is used for ridging in the deconvolution algorithm). | ||
===Algorithm=== | |||
If options.conv = 'convolve' {the default}, then convolution is performed. The inputs are <math>\mathbf{x}</math>, a 1x''N'' vector containing the signal, and <math>\mathbf{y}</math> a 1x''N'' vector containing a point source function. Then <math>\mathbf{\xi } =</math> <math>F\left( \mathbf{x} \right)</math> is the FFT of the signal and <math>\mathbf{\psi } =</math> <math>F\left( \mathbf{y} \right)</math> are the corresponding Fourier transforms. The convolved signal is <math>\mathbf{xf } =</math> <math>F^{-1} \left( \mathbf{\psi} \odot \mathbf{\xi} \right)</math> where <math> \odot </math> is the element-by-element Hadamard product. | |||
If options.conv = 'deconvolve', then deconvolution is performed. Noting that <math> \mathbf{\psi} \odot \mathbf{\xi} </math> can be written as <math> diag \left( \mathbf{\psi} \right) \mathbf{\xi} </math>, the deconvolved signal is given as <math>\mathbf{xg } =</math> <math>F^{-1} \left( \left( \mathbf{\psi}^{*} \odot \mathbf{\xi} \right) diag \left( \mathbf{\psi}^{*} \odot \mathbf{\psi} + \alpha\mathbf{1} \right) ^{-1} \right)</math> where <math> \alpha </math> is the regularization parameter given in (options.reg) , <math>\mathbf{1} </math> is a 1x''N'' vector of ones and <math> ^{*} </math> incicates complex conjugate. | |||
===See Also=== | ===See Also=== | ||
[[savgol]] |
Latest revision as of 10:29, 17 March 2009
Purpose
Spectral filtering via convolution and deconvolution.
Synopsis
- xf = line_filter(x,win,options);
Description
Inputs
- x = MxN matrix of data of class 'double' or 'dataset'. If 'dataset' it must x.type=='data'. Each of the M rows are convolved with the linear filter given in (options.lineshape).
- win =
- 1) A scalar parameter corresponding to the analogous window width of the filter.
- options.psf =
- 'gaussian', (win) corresponds to the std in the Gaussian distribution.
- 'box', (win) is the half-width in number of channels.
- 'triangular', (win) is the half-width in channels.
- options.psf =
- 2) If (win) is 1xN vector, then it is used as the PSF and (options.psf) is ignored. The FFT of the PSF is calculated and used in the convolution or deconvolution algorithm.
Outputs
- xf = Filtered data of class 'dataset'.
Options
options = a structure array with the following fields:
- psf: [ {'gaussian'} | 'box' | 'triangular'] Line shape or point source function (PSF) for filtering.
- conv: [ {'convolve'} | 'deconvolve' ] Governs the algorithm and tells it to convolve with the point source function given in (options.psf) or deconvolve. If 'deconvolve', then (options.reg) is used.
- reg: {1e-6} regularization parameter (this parameter is used for ridging in the deconvolution algorithm).
Algorithm
If options.conv = 'convolve' {the default}, then convolution is performed. The inputs are , a 1xN vector containing the signal, and a 1xN vector containing a point source function. Then is the FFT of the signal and are the corresponding Fourier transforms. The convolved signal is where is the element-by-element Hadamard product.
If options.conv = 'deconvolve', then deconvolution is performed. Noting that can be written as , the deconvolved signal is given as where is the regularization parameter given in (options.reg) , is a 1xN vector of ones and incicates complex conjugate.