Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tagwiki:tools:processing:comp_filt [2017/07/28 15:28]
das39 [Matlab & Octave]
tagwiki:tools:processing:comp_filt [2021/06/07 15:21]
sbf5 [R] fixed `fs`. we're moving away from this abbreviation, should be `sampling_rate`
Line 1: Line 1:
 +=====comp_filt===== ​
 +Complimentary filtering of a signal
 +-----
  
 +===== Syntax =====
 +=== Matlab & Octave ===
 +<​code>​
 +Xf = comp_filt(X,​fs,​fc) % X is a vector or matrix
 +   or
 +Xf = comp_filt(X,​fc) % X is a signal structure
 +</​code>​
 +===R===
 +<​code>​
 +Xf <- comp_filt(X,​fs,​fc) % X is a vector or matrix
 +   or
 +Xf <- comp_filt(X,​fc)  ​       % X is a signal list
 +</​code>​
 +
 +
 +===== Description =====
 + ​Complimentary filtering of a signal. This breaks signal X into two or more frequency bands such that the sum of the signals in the separate bands is equal to the original signal.
 +
 +===== Inputs =====
 +^ Input var ^ Description ​ ^Units ^Default value ^
 +| X | is a sensor vector or matrix (i.e., with a signal in each column), or a sensor structure. | N/A | N/A |
 +| fs | is the sampling rate of the sensor data (samples per second). fs is only needed if X is not a sensor structure. | Hz | N/A | 
 +| fc  | specifies the cut-off frequency or frequencies of the complimentary filters. If one frequency is given, X will be split into a low- and a high-frequency component. If fc contains more than one value, X will be split into multiple complimentary bands. Each filter length is 4*fs/fc. Filtering adds no group delay | Hz | N/A |
 +
 +===== Outputs =====
 +^ Output var ^ Description ^ Units^
 +|Xf| is a cell array of filtered signals. There are n+1 cells where n is the length of fc. Cells are ordered in Xf from lowest to highest frequency. Each cell contains a vector or matrix of the same size as X, and at the same sampling rate as X. | Hz |
 +
 +===== Notes & assumptions =====
 +===== Example =====
 +
 +==== Matlab & Octave ====
 +The example below uses data from the file testset1.nc.
 +You can download it from the [[http://​www.animaltags.org./​doku.php?​id=tagwiki:​datasets|animaltags website'​s example data sets]].
 +If the file is saved in your current working directory, load it via:
 +<​code>​
 +testset1 = load_nc(‘testset1.nc’)
 +</​code>​
 +<​code>​
 +Xf = comp_filt(testset1.A.data,​ testset1.A.sampling_rate,​ 0.8)
 +plott(Xf{1,​1},​ testset1.A.sampling_rate,​ Xf{1,2}, testset1.A.sampling_rate)
 +</​code>​
 +==== R ====
 +The example below uses data from the file testset1.nc.
 +You can download it from the [[http://​www.animaltags.org./​doku.php?​id=tagwiki:​datasets|animaltags website'​s example data sets]].
 +If the file is saved in your current working directory, load it via:
 +<​code>​
 +testset1 <- load_nc(‘testset1.nc’)
 +</​code>​
 +<​code>​
 +Xf <- comp_filt(X = testset1$A$data,​ sampling_rate = testset1$A$sampling_rate,​ fc = .8)
 +xf <- list(Xf1 = Xf[[1]], Xf2 = Xf[[2]])
 +plott(xf, testset1$A$sampling_rate)
 +</​code>​
 +
 +===== About =====
 +[[bugs@animaltags.org]]
 +Last modified: 2 July 2017
  • tagwiki/tools/processing/comp_filt.txt
  • Last modified: 2021/06/07 15:21
  • by sbf5