Hi Zozo, I'll give you a couple examples where you reconstruct an approximation to a time-localized 100 Hz component.
But first, I should say the following. Your time- and scale-localized reconstruction of a signal will be better if you use cwtft.m and icwtft.m with logarithmically-spaced scales. The reason for that is that you have to keep in mind the inverse CWT is a single integral approximation to a double integral problem. It turns out that the stability of the reconstruction is better when we use certain scales and for certain wavelets where the Fourier transform has a nice expression. For the coif4 wavelet, that is not the case.
dt = 0.001;
t = linspace(0,1,1000);
x = cos(2*pi*100*t).*(t<0.5)+sin(2*pi*300*t).*(t>=0.75)+0.2*randn(size(t));
scales = 1:30;
cwtcoefs = cwt(x,scales,'coif4');
cwtstruct = struct('wav','coif4','cfs',cwtcoefs,'scales',scales,'meanSIG',mean(x),'dt',dt);
xrec = icwtlin(cwtstruct,'IdxSc',6:8);
plot(t,x,'r-.');
hold on;
plot(t,xrec,'k');
legend('Original Signal','Reconstruction with coif4 wavelet');
s0 = 2*dt;
ds = 0.4875;
NbSc = 20;
wname = 'morl';
sig = {x,dt};
sca = {s0,ds,NbSc};
wave = {wname,[]};
cwtsig = cwtft(sig,'scales',sca,'wavelet',wave);
newcfs = zeros(size(cwtsig.cfs));
indices = 4:6;
newcfs(indices,:) = cwtsig.cfs(indices,:);
cwtsig.cfs = newcfs;
xrec1 = icwtft(cwtsig);
figure;
plot(t,x,'r-.');
hold on;
plot(t,xrec1,'k');
legend('Original Signal','Reconstruction with Morlet Wavelet');
If you compare the two, you'll see that both techniques essentially isolate the 100-Hz component, but that the Morlet wavelet with logarithmically-spaced scales does a better job at the getting the amplitude right.
If you just want to find the localization of the signal feature at certain scales, then the coif4 wavelet works. If you are concerned about an accurate amplitude scaling, then cwtft and icwtft work better than cwt.m paired with icwtlin.m
Hope that helps, Wayne
Best Answer