Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# 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}$`

where

• a is a scale.

• Fc is the center frequency of the 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. From the above relationship, it can be seen that scale is inversely proportional to pseudo-frequency. For example, if the scale increases, the wavelet becomes more spread out, resulting in a lower pseudo-frequency.

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. The center frequency is a convenient and simple characterization of the dominant frequency of the wavelet.

## Examples

collapse all

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: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=20×3 table Scale Frequency Period __________ _________ __________ 0.0002 4062.5 0.00024615 0.00021435 3790.4 0.00026382 0.00022974 3536.6 0.00028276 0.00024623 3299.8 0.00030305 0.0002639 3078.8 0.0003248 0.00028284 2872.6 0.00034811 0.00030314 2680.3 0.0003731 0.0003249 2500.8 0.00039988 0.00034822 2333.3 0.00042858 0.00037321 2177 0.00045934 0.0004 2031.3 0.00049231 0.00042871 1895.2 0.00052764 0.00045948 1768.3 0.00056551 0.00049246 1649.9 0.0006061 0.0005278 1539.4 0.0006496 0.00056569 1436.3 0.00069623 ⋮ ```

The example shows how to create a contour plot of the CWT using approximate frequencies in Hz.

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 and plot the result.

```[cfs,f] = cwt(x,Fs); contour(t,f,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.