# 小波变换

## Overview: Why wavelet Transform?

### FT的局限性

For FT, no frequency information is available in the time-domain signal, and no time information is available in the Fourier transformed signal. The natural question that comes to mind is that is it necessary to have both the time and the frequency information at the same time? The FT gives the frequency information of the signal, which means that it tells us how much of each frequency exists in the signal, but it does not tell us when in time these frequency components exist. This information is not required when the signal is so-called stationary.

The FT gives the spectral content of the signal, but it gives no information regarding where in time those spectral components appear. Therefore, FT is not a suitable technique for non-stationary signal, 除非我们不关心non-stationary信号不同频率分量是什么时候出现的。

When the time localization of the spectral components (frequency components) are needed, a transform giving the TIME-FREQUENCY REPRESENTATION of the signal is needed.

### 终极方案——The Wavelet Transform

Often times a particular spectral component occurring at any instant can be of particular interest. In these cases it may be very beneficial to know the time intervals these particular spectral components occur. 小波变换 is capable of providing the time and frequency information simultaneously, hence giving a time-frequency representation of the signal. 波变换是作为STFT的替代品而开发的，或者说是为了克服STFT的一些与分辨率相关的问题。

• 在分频的过程就是让time-domain signal通过various highpass and low pass filters，filters should satisfy some certain conditions, so-called admissibility condition
• uncertainty principle: 频率和时间之间的不确定关系$$\Delta t \Delta f \geq \displaystyle\frac{1}{4 \pi}$$
we cannot exactly know what frequency exists at what time instance, but we can only know what frequency bands exist at what time intervals. 我们能做的最好的就是研究what spectral components exist at any given interval of time. This is a problem of resolution, and it is the main reason why researchers have switched to WT from STFT. STFT gives a fixed resolution at all times, whereas WT gives a variable resolution as follows:
• higher frequencies are better resolved in time，但是在frequency domain的分辨率不好;
• lower frequencies are better resolved in frequency，但是在time domain的分辨率不好.

## Fundamentals: The Fourier transform and the short term Fourier transform, resolution problems

• FT频谱计算的积分区间是从负无穷到正无穷，覆盖整个信号区间，即对所有任意时刻的频率分布做了累加处理，所以只会告诉你每个频率分量的贡献是多少，但是不会告诉你任意频率分量出现的位置。某个频率分量出现在$$t_1$$或者$$t_2$$，堆FT频谱具有相同的贡献。This is why Fourier transform is not suitable if the signal has time varying frequency, i.e., the signal is non-stationary.
• 在使用FT之前，知道信号是否是stationary很重要。

STFT：其实就是通过加窗的方法，把整个时域过程分解成无数个等长的小过程，每个小过程近似平稳，再傅里叶变换，就知道在哪个时间点上出现了什么频率了。对对于上一章节的图中的信号做STFT(更准确地说是STFFT)，就会看到10Hz, 25 Hz, 50 Hz, 100 Hz四个频域成分及其出现的时间。

• 由于STFT只是加了窗的FT，而一个实数信号的FT总是对称的，所以TFR从频率轴看是对称的也很正常。非要深究的话，这种对称特性和【负频率】有关，这是一个odd concept which is difficult to comprehend，这个概念在我们这里并不重要。
• 单看一半的图，存在四个peaks，分别对应不同的频率分量，而且它们 are located at different time intervals along the time axis。似乎我们已经得到一个完美的TFR结果？Not really!!!
• 存在的问题：还是测不准原理在捣乱，时间和频率之间的不确定性。one cannot know what spectral components exist at what instances of times. 这个问题和窗口函数的宽度有关。

FT和STFT对比：

• 对于FT，对频域信号，并不存在频率分辨率的问题，因为我们确切地知道存在哪些频率，对于时域信号，也不存在时间分辨率的问题，因为我们确切地知道每个时刻的信号值。但是，频域信号中的时间分辨率、时域信号的频率分辨率都为零；即研究频域信号某一确定频率的时间演化，或者研究某一确定时间的频率演化都是没有任何意义的。FT中的核函数$$e^{-i \omega t}$$让我们获得完美的分辨率，这是因为核本身就是一个无限长的窗口。
• 在STFT中，窗口宽度是有限的，每次只覆盖原始信号的一部分，所以频率分辨率不如FT，或者说分辨率变差，也就是说我们将不再知道某个确定的频率分量， we only know a band of frequencies that exist。

• 窄窗，时间分辨率高，频率分辨率低；
• 宽窗，时间分辨率低，频率分辨率高；

The answer, of course, is application dependent: If the frequency components are well separated from each other in the original signal, than we may sacrifice some frequency resolution and go for good time resolution, since the spectral components are already well separated from each other. However, if this is not the case, then a good window function, could be more difficult than finding a good stock to invest in.

## Multiresolition Analysis: The continuous wavelet transform

### Multiresolution Analysis

Multiresolution Analysis(MRA): analyzes the signal at different frequencies with different resolutions. 虽然存在时间-频率的不确定性原理，但是我们可以通过MRA这种方法来分析信号。这种方法，every spectral component is not resolved equally as was the case in the STFT。其特点如下：

• give good time resolution and poor frequency resolution at high frequencies;
• give good frequency resolution and poor time resolution at low frequencies.

### The Continuous Wavelet Transform

• The Fourier transforms of the windowed signals are not taken, and therefore single peak will be seen corresponding to a sinusoid, i.e., negative frequencies are not computed.
• The width of the window is changed as the transform is computed for every single spectral component, which is probably the most significant characteristic of the wavelet transform.
• CWT得到的结果并没有频率参数，instead, we have scale parameter which is defined as $$\displaystyle\frac{1}{\text{frequency}}$$.

CWT的公式如下：$$CWT_x^\psi(\tau,s) = \Psi_x^\psi(\tau,s) = \frac{1}{\sqrt{|s|}} \int x(t) \psi^* \left( \frac{t - \tau}{s} \right) dt$$其中$$\tau$$和$$s$$分别为translation parameter和scale parameter；$$\psi(t)$$为transforming function，也被称作mother wavelet，it gets this name due to two important properties of the wavelet analysis as explained below:

• wavelet的意思是a small wave，这里的"小"指的是窗口函数的有限宽度(紧支撑compactly supported)，-let是后缀，比如droplet水滴，booklet小册子，leaflet小树叶；
• 这里的"波"指的是function is oscillatory；
• The term mother implies that the functions with different region of support that are used in the transformation process are derived from one main function, or the mother wavelet. In other words, the mother wavelet is a prototype for generating the other window functions.

### The Scale

Scaling(缩放比例)从数学的角度看，该数值大意味着信号在时间域stretch out，数值小意味着信号compressed。上面的四个函数都是从同一个余弦函数演化而来的，唯一的差异就在与scale的选取。我们知道对于函数$$f(t)$$来说，$$f(st)$$表示corresponds to a contracted (compressed) version of $$f(t)$$ if $$s>1$$；但是在CWT中，$$s$$是分母，所以这里正好反过来，即大的$$s>1$$表示信号stretch out。