|
% 计算2FSK信号的HHT谱和边际谱
% 作者:xray 2007.11
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); |
|