www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/CrossCorrelationWithReflectionBoundaryExample.m

    %% Cross-Correlation with Reflection Boundary
% Obtain the MODWT of 36 years of Southern Oscillation Index and Truk 
% Islands pressure data with both periodic and reflection boundary 
% conditions. The |modwt| with the |'reflection'| option extends the input 
% signal symmetrically at the right boundary. The input signal is then 
% twice its original length. MODWTXCORR with the reflection boundary 
% handling reduces the number of wavelet and scaling coefficients at each
% half before computing the cross-correlation sequences. The size of the 
% cross-correlation sequences is the same as acquiring the MODWT with 
% the default periodic boundary condition. 

% Copyright 2015 The MathWorks, Inc.


load soi
load truk
%% 
% Obtain the MODWT with the default periodic boundary condition.
wsoi_default = modwt(soi); 
wtruk_default = modwt(truk);
%% 
% Obtain the MODWT with the reflection boundary condition.
wsoi_reflect = modwt(soi,'reflection');
wtruk_reflect = modwt(truk,'reflection');
%%
% Obtain the cross correlation sequences.
xcseq_default = modwtxcorr(wsoi_default,wtruk_default);
xcseq_reflect = modwtxcorr(wsoi_reflect,wtruk_reflect,'reflection');
%%
% Compare the number of elements in the cell array output for both
% boundary conditions. 
cellfun(@numel,xcseq_reflect)
cellfun(@numel,xcseq_default)