嗯,任何人都可以帮忙吗?我有一个信号,其中包含一些模式。我已经运行了 CWT 转换,但没有得到我想要的结果。所以我实现了一个包含频率 [0.1,0.3,0.6] Hz 的测试信号,以查看我的代码有什么问题。但结果是准确的。一旦我将频率更改为 [0.1,0.4,0.6] 或 [0.1,0.5,0.6]Hz,绘图上的结果就不再准确了。
你可以在这里看到情节:
这可能是因为 0.6Hz 模式的阻尼效应,或者......我实际上不知道 :( 我想我必须先解决为什么会发生这种情况才能获得我的实际信号模式。这是我的代码。
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 surface
figure;
sc=wscalogram('image',coefs,'scales',freq,'ydata',x); % get scalograme of x
xlabel('Time'); ylabel('Frequency of gen'); % set axis
hold on
abscof=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 on
axis([0 1 0 max(modI)*1.1]) % seting the axis
xlabel('Pseudo-Frequency (Hz)'); ylabel('abs(coefs)'); % seting the axis
感谢您的回复。