# [R] How to select the scale parameter for Gabor transform (Rwave)?

Joaquin Rapela rapela at ucsd.edu
Fri Apr 19 23:36:56 CEST 2013

```Dear list,

I am trying to choose the scale parameter for the cgt transform but I don't
know how to do it. In time I would like to be able to separate points 30
samples apart, and in frequency I would like to separate bands 0.04 Hz
apart. I tried the two approaches described below and they gave me
different results.  I would appreciate advise on how to do this.

The Rwave Gabor transform uses a Gaussian window; i.e.,
g(x)=exp(-x^2/(2*sigma)), with radius deltaG=sqrt(sigma/2). The Fourier
transform of this window has a radius deltaGHat=1/sqrt(2*sigma). Solving
for deltaG=10 I get sigma=200, which in turn gives
deltaGHat=0.05 radians=0.008 Hz. So, sigma=200 should satisfy the
requirements above.

To make sure sigma=200 works in practice, I computed the Gabor transform of
two sinusoids separated by 0.04 Hz plus two spikes separated by 30 points
using the code below. I obtained an excellent frequency resolution but a
disastrous temporal resolution
http://sccn.ucsd.edu/~rapela/scaleSelectionProblem/gtResultSigma200.jpg. To
obtain decent frequency and temporal resolutions I used sigma=10
http://sccn.ucsd.edu/~rapela/scaleSelectionProblem/gtResultSigma10.jpg.

fromTime <- 0
toTime <- 250
by <- 1
ts <- seq(from=fromTime, to=toTime)
f1 <- 0.01
f2 <- 0.05
t1 <- 50
t2 <- 80
K <- 15
fMax <- 0.20
nf <- 100
df <- fMax/(nf/2)
scale <- 10

ys <- sin(2*pi*f1*ts) + sin(2*pi*f2*ts)
ys[t1] <- K
ys[t2] <- K

plot(x=ts, y=ys, xlab="Time", ylab="Signal", type="b")
cgtsinwave <- cgt(input=ys, nvoice=nf, freqstep=df, scale=scale, plot=TRUE)

Many thanks, Joaquin

--
Joaquin Rapela, PhD
Swartz Center for Computational Neuroscience
University of California San Diego
9500 Gilman Drive,
San Diego, CA 92093-0559
tel: (858) 822-7536
fax: (858) 822-7556
http://sccn.ucsd.edu/~rapela

```