www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/WaveletCoherenceUsingSmoothedNumberOfScalesExample.m
%% Effect of Number of Smoothed Scales on Wavelet Coherence % Obtain the wavelet coherence for two signals. Both signals consist of two % sine waves (10 Hz and 50 Hz) in white noise. Use the default number of % scales to smooth. This value is equivalent to the number of voices per % octave. Both values default to 12. %% % Set the random number generator to its default settings for % reproducibility. Then, create the two signals and obtain the coherence. rng default; t = 0:0.001:2; x = cos(2*pi*10*t).*(t>=0.5 & t<1.1)+ ... cos(2*pi*50*t).*(t>= 0.2 & t< 1.4)+0.25*randn(size(t)); y = sin(2*pi*10*t).*(t>=0.6 & t<1.2)+... sin(2*pi*50*t).*(t>= 0.4 & t<1.6)+ 0.35*randn(size(t)); wcoherence(x,y); %% % Set the number of scales to smooth to 16. The increased smoothing causes % reduced low frequency resolution. wcoherence(x,y,'NumScalesToSmooth',16);