g=pgauss(L); g=pgauss(L,tfr); g=pgauss(L,...); [g,tfr]=pgauss( ... );
L | Length of vector. |
tfr | ratio between time and frequency support. |
g | The periodized Gaussian. |
pgauss(L,tfr) computes samples of a periodized Gaussian. The function returns a regular sampling of the periodization of the function \(exp(-pi*(x.^2/tfr))\).
The \(l^2\) norm of the returned Gaussian is equal to 1.
The parameter tfr determines the ratio between the effective support of g and the effective support of the DFT of g. If \(tfr>1\) then g has a wider support than the DFT of g.
pgauss(L) does the same setting tfr=1.
[g,tfr] = pgauss( ... ) will additionally return the time-to-frequency support ratio. This is useful if you did not specify it (i.e. used the 'width' or 'bw' flag).
The function is whole-point even. This implies that fft(pgauss(L,tfr)) is real for any L and tfr. The DFT of g is equal to pgauss(L,1/tfr).
In addition to the 'width' flag, pgauss understands the following flags at the end of the list of input parameters:
'fs',fs | Use a sampling rate of fs Hz as unit for specifying the width, bandwidth, centre frequency and delay of the Gaussian. Default is fs=[] which indicates to measure everything in samples. |
'width',s | Set the width of the Gaussian such that it has an effective support of s samples. This means that approx. 96% of the energy or 79% of the area under the graph is contained within s samples. This corresponds to -6dB or to width at the half of the height. This is equivalent to calling pgauss(L,pi*s^2/4L*log(2)). |
'atheight',ah | Used only in conjuction with 'width'. Forces the Gaussian to width s at the ah fraction of the height. |
'bw',bw | As for the 'width' argument, but specifies the width in the frequency domain. The bandwidth is measured in normalized frequencies, unless the 'fs' value is given. |
'cf',cf | Set the centre frequency of the Gaussian to fc. |
'wp' | Output is whole point even. This is the default. |
'hp' | Output is half point even, as most Matlab filter routines. |
'delay',d | Delay the output by d. Default is zero delay. |
In addition to these parameteres, pgauss accepts any of the flags from setnorm. The output will be normalized as specified.
If this function is used to generate a window for a Gabor frame, then the window giving the smallest frame bound ratio is generated by pgauss(L,a*M/L).
This example creates a Gaussian function, and demonstrates that it is its own Discrete Fourier Transform:
g=pgauss(128); % Test of DFT invariance: Should be close to zero. norm(g-dft(g))
The next plot shows the Gaussian in the time domain:
plot(fftshift(pgauss(128)));
The next plot shows the Gaussian in the frequency domain on a log scale:
magresp(pgauss(128),'dynrange',100);
The next plot shows the Gaussian in the time-frequency plane:
sgram(pgauss(128),'tc','nf','lin');
S. Mallat and Z. Zhang. Matching pursuits with time-frequency dictionaries. IEEE Trans. Signal Process., 41(12):3397--3415, 1993.