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

Joaquin Rapela rapela at ucsd.edu
Sat Apr 20 05:25:03 CEST 2013


Dear list,

It seems that there is a typo in the book "Practical Time-Frequency Analysis"
that documents Rwave. The window that the cgt function of Rwave seems to be 
using 

g(x)=exp(-x^2/(2*sigma^2))

and not

g(x)=exp(-x^2/(2*sigma))

as stated in Equation (3.23) of the book. Also, it appears that the scale
parameter in the cgt of Rwave equals sigma. In the previous email I derived an
optimal sigma=200, and if in the code below I use sigma=sqrt(200), I obtain a 
Gabor transform with good time-frequency resolution.

I am copying the authors of Rwave in this message. If the previous observation
is correct, it would be a good idea to discuss it in the documentation of Rwave.

Cordially, Joaquin

scale
On Fri, Apr 19, 2013 at 02:36:56PM -0700, Joaquin Rapela wrote:
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
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
----------------------------------

Elle [Il dispendieux] suppose une volonté de mouvement, un consentement aux flux
et aux fleuves.  D'où l'héraclitéisme du dispendieux que veut et aime la
mobilité, que sollicite la circulation dans le dessein de produire des
opportunités pour une plus grande probabilité de dépenses. Il n'ignore pas
l'inscription de son existence dans une perspective dialectique. Au-delà de
l'ontologie ou de la métaphysique, il sait n'avoir pour seul capital que sa vie,
qu'elle ne durera pas éternellement, que déjà elle es comptée, dès à présent
limitée. Et, for de ce savoir, il a d'autant d'enthousiasme qu'il apprécie
l'extrême valeur de ce que ne dure pas. La mort donne le prix, elle fixe le
sens.

                                      Michel Onfray
                                      La sculpture de soi: la morale esthétique

[El dispendioso] Supone una voluntad de movimiento, un consentimiento a flujos y
ríos. De ahí, el heracliteísmo del dispendioso que desea y al que le gusta la
movilidad, que solicita la circulación con el objeto de producir oportunidades
para una mayor probabilidad de gasto. No ignora que su vida se inscribe en una
perspectiva dialéctica. Más allá de la ontología o de la metafísica, sabe que
que su único capital es su vida y que ésta no durará enternamente, que ya tiene
los días contados, que está limitada en ese momento.  Y, sabiendo eso, su
entusiasmo es directamente proporcional a su aprecio por el extremo valor de lo
que no dura. La muerte pone el precio, fija el sentido.

                                    Michele Onfray
                                    La Escultura de Sí: por una moral estética



More information about the R-help mailing list