using conofinf to plot the cone of influence in a imagesc(time, freq, coeffs)

Hello there
I have done the cwt of a signal
coeffs=cwt(signal, scales, wavelet)
scales are obtained as this: freq=1:1: 1000 Hz
then I do the freq2scale conversion (my own routine very obvious)
scales=centfrq(wavename)./(freq*(1/fs));
so I end up having a vector of scales not equaly spaced (1/x rule)
However I want the plot to be related to the freq in Hz, so:
imagesc(time, freq, abs(coeffs)) ---works fine!!
Now I would want to put in this plot the limits of the influence cone by doing
[PLmin,PRmax] = conofinf(wavename,scales,length(x),[]);
just doing [cone] = conofinf(wavename,scales,length(x),[]); will not work because my imagesc is ploted with time versus pseudo-frquencies.
Note that scales is a non-linear vector
How do I go about putting a cone of influence in the above imagesc plot?
many regards´ para

댓글 수: 4

Hi, I don't know if it's still useful. But here's what I did when I had the same problem:
LenSig = length(signal);
wname = 'morl'
% construct your freq. vector
freq=1:1:1000;
% transform to scales
Fc = centfrq(wname);
scales = Fc./(f*dt);
% get wavelet transform
coefs = cwt(sig,scales,wname);
S = abs(coefs.*conj(coefs));
WT = S./N;
% plot wavelet transform / scalogram
figure;
imagesc(t,freq,WT);
axis square;
colorbar;
% annotate axes and title
title('Coefficients of continuous wavelet transform');
xlabel('Time');
ylabel('Pseudo-frequency');
% get cone of influence
% Here, you have to specify points at which you want to calculate COI
% as the last parameter:
cone = conofinf(wname,scales,LenSig,[1 LenSig]);
% combine left and right edges
cone = [cone{1}(:,floor(1:LenSig/2)) cone{2}(:,ceil(LenSig/2):end)];
% previous steps give you an area under COI
% you can see it with: figure; imagesc(cone);
% now, we want to get the border of this area
coi = zeros(1,LenSig);
for idx = 1:LenSig
valcoi = find(cone(:,idx)==1,1,'last');
if ~isempty(valcoi)
coi(idx) = f(valcoi);
end
end
% now plot COI border on top of your wavelet transform
hold on;
plot(t,coi,'k','LineWidth',1.5);
hold off;
Optionally, you can hatch the area under COI, but it's a bit of a hack and it's not ideal. For this you will need hatchfill function. Once you have this function on your path, you can use it like this:
[~,h] = contourf(t,freq,cone*max(WT(:)),[1 1]*max(WT(:)));
hPatch = findobj(h, 'Type', 'patch');
hh = hatchfill(hPatch, 'cross', 45, 10);
I also constructed frequency vector and computed scales from it. This method worked fine for me.
May i ask what is the variable of t and N? and what are the function f(valcoi)?
Sorry for only replying now, and for your reply: I will try that code in the next few days and will come back. Cheers
What is the variable for N?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

질문:

2012년 12월 14일

댓글:

2020년 11월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by