-1
$\begingroup$

enter image description here

i'm trying to apply the cwt function from matlab in the first graph and from the different articles that i've read i should get something that shows different peaks to determine the location of damage, but all i'm getting is that spaghetti looking mess. is there a different approach to applying wavelet transform without using the built in function? thanks

$\endgroup$

closed as off-topic by Stanley Pawlukiewicz, MBaz, lennon310, jojek Mar 11 at 14:20

  • This question does not appear to be about signal processing within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Spaghetti happens because of the complex attitude of some CWT, that you already managed with Fourier. $\endgroup$ – Laurent Duval Mar 7 at 9:04
  • $\begingroup$ does this mean that applying cwt to this signal is not possible? $\endgroup$ – Stephen Lopez Mar 7 at 9:11
  • $\begingroup$ That is possible, and possibly more informative than with Fourier, as the signal is not stationary. $\endgroup$ – Laurent Duval Mar 7 at 9:14
  • $\begingroup$ your spaghetti is probably an artifact of your plot call, not the cwt $\endgroup$ – Stanley Pawlukiewicz Mar 8 at 2:17
  • 4
    $\begingroup$ I'm voting to close this question as off-topic because the problem has to do with calling matlab’s plot function with complex values and not a problem with wavelets $\endgroup$ – Stanley Pawlukiewicz Mar 8 at 2:22
0
$\begingroup$

Trying to guess which signal you are analyzing, and the purpose, here is a demo, on a real signal, with half the Fourier spectrum, and the corresponding continuous wavelet transform scalogram.

Here, I suspect that the signal is too short (without further objectives) for FFT and CWT to yield interpretable results. The Matlab code is:

nsample = 64; % An odd number
timeSampling = 1/nsample;
time = (0:nsample-1)*timeSampling;
ratioSecondHalf = 20;
data = zeros(nsample,1);
data(1:nsample/2,1) = rand(nsample/2,1)-0.5;
data = medfilt1(data,5);
data(nsample/2+1:end,1) = rand(nsample/2,1)/ratioSecondHalf;

[fftR,fftAxe] = FFTR(data,timeSampling);

[cwtCoeff,cwfFreq] = cwt(data,1:64,'morl',timeSampling); 

figure(1);clf
subplot(3,1,1)
plot(time,data,'x-');;axis tight
xlabel('Time (a. u.)')
ylabel('Amplitude (a. u.)')
subplot(3,1,2)
plot(fftAxe,fftR,'x-');axis tight
xlabel('Frequency (a. u.)')
ylabel('Amplitude (a. u.)')
subplot(3,1,3)
h=imagesc('XData',time,'YData',2*cwfFreq/pi,'CData',abs(cwtCoeff));axis tight
xlabel('Time (a. u.)')
ylabel('Frequency (a. u.)')

FFTR.m is obtained from here.

Non-stationary signal, Fourier spectrum and continuous wavelet transform

$\endgroup$
  • $\begingroup$ i've also tried this on a longer signal but it still gave me spaghetti i think it's because it's non-stationary like you said. $\endgroup$ – Stephen Lopez Mar 7 at 13:29
  • 2
    $\begingroup$ Abslute value is lacking somewhere $\endgroup$ – Laurent Duval Mar 7 at 15:39
  • $\begingroup$ ANd the longer length is about interpretability, not spaghetti $\endgroup$ – Laurent Duval Mar 9 at 16:22
  • 1
    $\begingroup$ i did it with absolute value and i got better results, no more spaghetti. $\endgroup$ – Stephen Lopez Mar 11 at 14:42
  • $\begingroup$ Good, spaghetti arise from plotting complex values as 2D points (real+imaginary) $\endgroup$ – Laurent Duval Mar 11 at 15:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.