This example shows how to perform time-frequency analysis using the continuous wavelet transform (CWT). Continuous wavelet analysis provides a time-scale/time-frequency analysis of signals and images. The Wavelet Toolbox™ software has both command line and interactive functionality to support continuous wavelet analysis of 1-D signals and 2-D images. To perform continuous wavelet analysis with the interactive tool, enter wavemenu at the MATLAB® command line and click one of the following choices: Continuous Wavelet 1-D, Complex Continuous Wavelet 1-D, Continuous Wavelet 1-D (Using FFT), or Continuous Wavelet Transform 2-D.
Construct a signal consisting of two sinusoids with frequencies of 100 and 50 Hz. The data is sampled at 1 kHz. The support of the two sinusoids is disjoint. The 100-Hz sine wave begins at t=0 and has a duration of 1 second. The 50-Hz sinusoid begins at three seconds and has a duration of two seconds.
Use the complex-valued (nonanalytic) Morlet wavelet, cmor1-1. To determine the scales of interest, assume you are interested in the frequency region from 10 to 125 Hz. To determine the range of scales corresponding to [10,125], use centfrq.
Fs = 1000; fc = centfrq('cmor1-1'); % a = fc/(freq*dt) freqrange = [20 150]; scalerange = fc./(freqrange*(1/Fs));
With your scales of interest, obtain a scalogram analysis.
t = linspace(0,5,5e3); x = cos(2*pi*100*t).*(t<1)+cos(2*pi*50*t).*(3<t)+0.3*randn(size(t)); scales = scalerange(end):0.2:scalerange(1); Coeffs = cwt(x,scales,'cmor1-1'); SCImg = wscalogram('image',Coeffs,'scales',scales,'ydata',x,'xdata',t);