scal2frq

Scale to frequency

Syntax

`F = scal2frq(A,'wname',DELTA)scal2frq(A,'wname')scal2frq(A,'wname',1)`

Description

`F = scal2frq(A,'wname',DELTA)` returns the pseudo-frequencies corresponding to the scales given by `A` and the wavelet function `'wname'` (see `wavefun` for more information) and the sampling period `DELTA`.

`scal2frq(A,'wname')` is equivalent to `scal2frq(A,'wname',1)`.

There is only an approximate answer for the relationship between scale and frequency.

In wavelet analysis, the way to relate scale to frequency is to determine the center frequency of the wavelet, Fc, and use the following relationship.

${F}_{a}=\frac{{F}_{c}}{a\cdot \Delta }$

where

• a is a scale.

• Δ is the sampling period.

• Fc is the center frequency of a wavelet in Hz.

• Fa is the pseudo-frequency corresponding to the scale a, in Hz.

The idea is to associate with a given wavelet a purely periodic signal of frequency Fc. The frequency maximizing the Fourier transform of the wavelet modulus is Fc. `centfrq` computes the center frequency for a specified wavelet.

Some examples of the correspondence between the center frequency and the wavelet are shown in the following figure.

Center Frequencies for Real and Complex Wavelets

As you can see, the center frequency-based approximation captures the main wavelet oscillations. Therefore, the center frequency is a convenient and simple characterization of the dominant frequency of the wavelet.

Dilating the wavelet by a, changes the center frequency to Fc / a. If the underlying sampling period is Δ, the scale a corresponds to the frequency

${F}_{a}=\frac{{F}_{c}}{a\cdot \Delta }$

`scal2frq` computes this correspondence.

Examples

collapse all

Scales To Frequencies

Construct a vector of scales with 10 voices per octave over five octaves. Assume the data are sampled at 10 kHz.

```voicesperoctave = 10; numoctaves = 5; a0 = 2^(1/voicesperoctave); Fs = 1e4; scales = ... a0.^(voicesperoctave:1/voicesperoctave:numoctaves*voicesperoctave); ```

Convert the scales to approximate frequencies in hertz for the Morlet wavelet.

```Frq = scal2frq(scales,'morl',1/Fs); ```

Determine the corresponding periods. Construct a table with the scales, the corresponding frequencies, and periods. Display the smallest 20 scales along with their corresponding frequencies and periods.

```Frq = Frq(:); scales = scales(:); T = [scales.*(1/Fs) Frq 1./Frq]; T = array2table(T,'VariableNames',{'Scale','Frequency','Period'}); T(1:20,:) ```
```ans = Scale Frequency Period __________ _________ __________ 0.0002 4062.5 0.00024615 0.00020139 4034.4 0.00024787 0.00020279 4006.6 0.00024959 0.0002042 3978.9 0.00025133 0.00020562 3951.4 0.00025307 0.00020705 3924.1 0.00025483 0.00020849 3897 0.00025661 0.00020994 3870.1 0.00025839 0.0002114 3843.4 0.00026019 0.00021287 3816.8 0.000262 0.00021435 3790.4 0.00026382 0.00021585 3764.3 0.00026566 0.00021735 3738.3 0.0002675 0.00021886 3712.4 0.00026936 0.00022038 3686.8 0.00027124 0.00022191 3661.3 0.00027312 0.00022346 3636 0.00027502 0.00022501 3610.9 0.00027694 0.00022658 3586 0.00027886 0.00022815 3561.2 0.0002808 ```

Plot CWT with Frequencies instead of Scales

The example shows how to plot the CWT using approximate frequencies in Hz instead of scales. This creates a time-frequency plot instead of a time-scale plot.

Create a signal consisting of two sine waves with disjoint support in additive noise. Assume the signal is sampled at 1 kHz.

```Fs = 1000; t = 0:1/Fs:1-1/Fs; x = 1.5*cos(2*pi*100*t).*(t<0.25)+1.5*cos(2*pi*50*t).*(t>0.5 & t<=0.75); x = x+0.05*randn(size(t)); ```

Obtain the CWT of the input signal with the Morlet wavelet. Set the number of voices per octave to 32. Create a scale vector to cover 6 octaves. The initial scale is where is the sampling interval.

```numvoices = 32; a0 = 2^(1/numvoices); numoctaves = 6; scales = a0.^(2*numvoices:1/numvoices:numoctaves*numvoices); cfs = cwt(x,scales,'morl'); ```

Convert the scales to approximate frequencies and plot the result.

```pfreq = scal2frq(scales,'morl',1/Fs); contour(t,pfreq,abs(cfs).^2); axis tight; grid on; xlabel('Time'); ylabel('Approximate Frequency (Hz)'); title('CWT with Time vs Frequency'); ```

References

Abry, P. (1997), Ondelettes et turbulence. Multirésolutions, algorithmes de décomposition, invariance d'échelles, Diderot Editeur, Paris.