I have a signal that contains some modes in it. I've run a CWT transform but I haven't got my desired results. so I implement a test signal that contains freqs [0.1,0.3,0.6] Hz to see whats the problem with my codes. but the result was accurate. once I change the freqs to [0.1,0.4,0.6] or [0.1,0.5,0.6]Hz,The results wasn't accurate anymore on the plot. you can see the plot here, http://cubeupload.com/im/4msYBt.jpg.It might be for the damping effect of the 0.6Hz mode or … I don't know actually 🙁 I think I must fix why this happening first to get my actual signal modes. here's my codes.
t=linspace(0,30,300);Fs=ceil(inv(t(2)-t(1))); % sampling freq
x=sin(2*pi*t*0.1).*(t<10)+sin(2*pi*t*0.3).*... (t<30)+sin(2*pi*t*0.6).*(t<10).*exp(-t*.1); % my signal[0.1Hz,0.3Hz,0.6Hz]
wname = 'morl'; % define wavelet name
scales = 1:1:128; % scales range
coefs = cwt(x,scales,wname,'lvlabs'); % Get coefs of x
freq = scal2frq(scales,wname,1/Fs); %convert scales to freq range
surf(t,freq,abs(coefs));shading('interp'); % 3D surface plot
axis tight; xlabel('Seconds'); ylabel... % seting the axis 3D surface ('Pseudo-Frequency (Hz)'); % seting the axis 3D surface
axis([0 length(t)/Fs 0 1 0 max(coefs(:))*1.1]) % seting the axis 3D surfacefigure;sc=wscalogram('image',coefs,'scales',freq,'ydata',x); % get scalograme of x
xlabel('Time'); ylabel('Frequency of gen'); % set axis
hold onabscof=abs(coefs)'; % |coefs|'
modI=max(abscof); % get max |coefs| coresponde to freqs of x
modI=modI/max(modI); % scale each clumn 0-1
figure;plot(freq,modI) % Plot all modes. contain all
grid onaxis([0 1 0 max(modI)*1.1]) % seting the axis
xlabel('Pseudo-Frequency (Hz)'); ylabel('abs(coefs)'); % seting the axis
Best Answer