📄 gmskspec.m
字号:
%----------------------------------------------------
% Compute the spectra of various GMSK signals
%----------------------------------------------------
K = 20; % number of blocks to simulate
N = 32*256; % number of symbols to simulate
Nsmp = 16; % number of samples per symbol
h = 0.5; % modulation index
L = 9; % pulse length in symbol periods
T = 1; % symbol length
spec = zeros(N*Nsmp,1);
%------------------------------------------------------------
% GMSK pulse shape
%------------------------------------------------------------
t = [0: 1/Nsmp : L*T];
c1 = sqrt(2*pi/log(2));
W = 0.30;
g = c1*W*exp(- c1^2 *pi* W^2 * (t-L*T/2).^2); % must integrate to 1/2 over one symbol period
% MSK modulation
q0 = filter(g,1,[zeros(1,Nsmp*L*T) ones(1,Nsmp) zeros(1,Nsmp*L*T)]);
q = cumsum(q0);
qNorm = 0.5/max(q);
%---------------------------------------------------------------
% Generate signal
%----------------------------------------------------------------
temp = [];
for i=1:K
d = 2*floor(2*rand(1,N)) - 1;
d = ones(Nsmp,1) * d;
dd = d(:);
freqpulse = filter(g,1,dd);
phi = 2*pi*h* cumsum(freqpulse)*qNorm; %/Nsmp;
signal = exp(j*phi);
spec = spec + abs(fft(kaiser(length(signal),2).*signal)).^2;
i
end
%-----------------------------------------------
% Plot spectrum
%-----------------------------------------------
Fs = 1;
[freq,specdB] = plotspec(spec,Fs,Nsmp,N);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -