Description Usage Arguments Value Examples
This function filters data using specified FIR filter coefficients.
1 2 | convolve1d(x,fir,subtractMed=TRUE)
|
x |
A numeric matrix where the columns are to be filtered. |
fir |
The FIR filter coefficients. This should always be a sinc or windowed sinc. Using other fir coefficients will lead to wrong results. |
subtractMed |
Should the Median be subtracted prior to convolution to prevent Gibb's ringing. |
Returns the filtered signal.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## 1. construct a sinusoid oscillating at .03Hz for 600s with a TR of 2.16s
## 2. add a sinusoid oscillating at .15Hz for 600s with a TR of 2.16s
## 3. make large matrix of signals
test<-sin(2*pi*.03*(seq(0,600,2.16)))
test.noise<-test+sin(2*pi*.15*(seq(0,600,2.16)))
test.mat<-matrix(test.noise,nrow=length(test.noise),ncol=5)
## compute an impulse response. In this case a kaiser window
kais<-kaiserWin(fl=.08,tw=.025,sf=1/2.16,d.sa=70,d.pbr=.1,type="low")
system.time(filt<-convolve1d(test.mat,kais,subtractMed=TRUE))
par(mfrow=c(3,1))
ts.plot(test,ylim=c(-2,2))
ts.plot(test.mat[,1],ylim=c(-2,2))
ts.plot(filt[,1],ylim=c(-2,2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.