matlab Time-Frequency Analysis toolbox application and example of wavelet scale graph function
# # #原创, reprint please indicate the source # # #
The Time-frequency Toobox is a powerful, one-frequency analysis tool box. This paper describes the use of Tfrscalo (wavelet scale graph) function in the Toolbox, and combines the examples. Based on Matlab r2016a. 1. Introduction to Functions:
Tfrscalo function:
Calculates the Morlet or Mexican hat wavelet scale spectrum of a signal.
Invocation form:
[Tfr,t,f,wt]=tfrscalo (X,t,wave,fmin,fmax,n,trace)
Input:
X: The signal to be analyzed, the inside of the function will convert the x to its analytic signal form for analysis.
T: Signal time domain range for time-frequency analysis, default: 1:nx (Nx indicates signal length)
Wave:morlet the half-length of wavelet analysis. If wave=0, use Maxican hat
Wavelet. The larger the wave, the lower the resolution of the time domain, the higher the frequency domain resolution.
Fmin,fmax: The frequency and the lower bound of the signal analysis.
Value range: 0<fmin,fmax<=0.5
Note: This frequency is a relative value, multiplied by FS (sampling frequency) to get the true frequency. 0.5 corresponds to the Nyquist frequency (half of the sampling frequency).
N: Frequency points.
TRACE: If you take a value other than 0, the algorithm process is displayed.
Output:
TFR: Time-frequency analysis result matrix. The horizontal axis corresponds to the time of linear sampling, and the ordinate corresponds to the frequency of geometric progression.
F: Normalized frequency coordinate ()
WT: The complex matrix containing the corresponding wavelet transform. 2. Example Description: 2.1 Construction of the test signal:
The sinusoidal signal, which is added in the time domain frequency ladder type, is implemented by the following statements:
T_test=1:0.001:11;
duration=1000;
For I=1:length (t_test)
F_sig (i) = (Floor (i/duration) +1) *20;
Sig_test (i) =sin (2*pi*f_sig (i) *t_test (i));
End
wherein the duration corresponds to the duration of each frequency, F_sig (i) corresponds to the frequency of the I Moment (Hz)
The test signal sampling rate is 1000Hz, the 1th second frequency is 20Hz, the 2s frequency is 40Hz,
..., section 10s frequency is 200Hz
Draw its time domain waveform with the following statement:
Plot (sig_test);
xt_test=1000:1000:10000;
Set (GCA, ' XTick ', xt_test, ' Xticklabel ', xt_test./1000);
Xlabel (' time/s ');
Title (' Test signal time domain graph ');
2.2 Time-frequency analysis and drawing statements
Frequency-based analysis and plotting are implemented using the following statements:
Examples of parameter settings for the frequency-of analysis:
[Tfr,t,f,wt]=tfrscalo (Sig_test '), 1:length (sig_test), 20,0.01,0.5,1024,2);
Drawing section (not repeated below):
xt=1000:1000:10000;
yt=1:100:1000;
Ytlabel=zeros (a size (YT));
For I=1:size (yt,2)
Ytlabel (i) =round (1000*f (YT (i)));% here multiply sampling frequency (1000Hz) to convert normalized frequency to true frequency (Hz)
End
Imagesc (TFR);
Set (GCA, ' XTick ', XT, ' Xticklabel ', xt./1000);
Set (GCA, ' Ytick ', YT, ' Yticklabel ', Ytlabel);
Set (GCA, ' ydir ', ' normal ');
Xlabel (' time/s ');
Ylabel (' frequency/hz ');
Colorbar;
Title (' Test signal time-frequency Analysis chart '); 2.3 Time-Frequency analysis results comparison: 2.3.1 about T parameter 2.3.1.1 t=1:length (sig_test)
[Tfr,t,f,wt]=tfrscalo (Sig_test '), 1:length (sig_test), 20,0.01,0.5,1024,2);
2.3.1.2 t=1:0.5*length (sig_test)
[Tfr,t,f,wt]=tfrscalo (Sig_test '), 1:0.5*length (sig_test), 20,0.01,0.5,1024,2);
2.3.2 About wave parameters 2.3.2.1 wave=5
[Tfr,t,f,wt]=tfrscalo (Sig_test '), 1:length (sig_test), 5,0.01,0.5,1024,2);
2.3.2.2 wave=100
[Tfr,t,f,wt]=tfrscalo (Sig_test '), 1:length (sig_test), 100,0.01,0.5,1024,2);
It can be observed that when wave increases, the frequency domain resolution is increased, but the time domain resolution is decreased (but the effect on the low frequency is greater and the high frequency effect is smaller). The two can not be optimal at the same time, so it is very important to choose a suitable wave parameter. 2.3.3 About Fmin,fmax parameters
These two parameters determine the frequency domain analysis range, for example, for the test signal, take fmin=0.1,fmax=0.3, the frequency domain analysis range is 100~300hz
[Tfr,t,f,wt]=tfrscalo (Sig_test '), 1:length (sig_test), 100,0.1,0.3,1024,2);
3. Summary
The basic usage of Tfrscalo function is this, but because of my knowledge level is limited, inevitably there are deficiencies and mistakes, welcome everyone to criticize correct, exchange discussion.
Resources:
1. "Matlab Time-frequency analysis technology and its application" GE philosophy is waiting for
2. Tfrscalo function Help documentation
Attached TFTB (time-frequency Toolbox) Download Address:
1. http://tftb.nongnu.org/(official address)
2. Http://pan.baidu.com/s/1c1WLfrU (Baidu Network disk)