|
想請問54樓高手,不知道您有沒有看過網上某位大大貼的這段程式,網址:http://forum.vibunion.com/thread-95023-1-1.html,怎麼我使用package_emd的工具,可以順利執行,但是跑出來的E數值卻會顯示Too many elements??無法像作者跑出來的結果一樣??執行後只有第一張圖有訊號,第二張跟第三張都是錯誤的><"程式如下:
clear;
rand('seed', 0);
T = 0.05; % 仿真??
R = 500; % ?速率
fd = 1000; % ?波?差
fc = 2000; % ?波?率
fs = 20000; % 采?率
samp = fs/R; % 每??元上的采???
N = T*fs;
n = 1:N;
x = randint(1, R*T, 2);
y = fskmod(x, 2, fd, samp, fs);
y = y .* exp(i*2*pi*fc/fs*n);
y = real(y);
% z = awgn(y, 20, 'measured');
z = y;
imf = emd(z);
[A, fa, tt] = hhspectrum(imf);
if size(imf,1) > 1
[A,fa,tt] = hhspectrum(imf(1:end-1, :));
else
[A,fa,tt] = hhspectrum(imf);
end
[E, tt1] = toimage(A,fa,tt,length(tt));
for k = 1:size(E,1)
bjp(k) = sum(E(k,:))*1/fs*1/T;
end
f = (0:N-3)/N*(fs/2);
figure(1)
plot(z);
figure(2)
imagesc(tt1,[0,0.5*fs],E);
set(gca,'YDir','normal')
% 使用灰度??示
% colormap(flipud(gray))
figure(3)
plot(f, bjp); |
|