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
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.