📄 test.asv
字号:
Q = 8; % Number of samples per symbol in baseband
pulse_shape = ones(1, Q);
% Matched filter impulse response.
mf_pulse_shape = fliplr(pulse_shape);
m1 = [1+3i 4+i 4+3i 1-i 1+i 1-3i 1-3i 1+3i 4+i 4-i 4-3i];
% Upsample the signal, apply pulse shaping.
tx = upfirdn(m1, pulse_shape, Q, 1);
%%%
%%% AWGN Channel
%%%
% Compute variance of complex noise according to report.
sigma_sqr = norm(pulse_shape)^2 / 10^(-3/10); ;
% Create noise vector.
n = sqrt(sigma_sqr/2)*(randn(size(tx))+j*randn(size(tx)));
% Received signal.
rx = tx + n;
%%%
%%% Receiver
%%%
% Matched filtering.
mf=conv(mf_pulse_shape,rx);
% Synchronization. The position and size of the search window
% is here set arbitrarily. Note that you might need to change these
% parameters. Use sensible values (hint: plot the correlation
% function used for syncing)!
t_start=1
t_end=t_start+50*8;
t_samp = sync(mf, m1, Q, t_start, t_end)
% Down sampling. t_samp is the first sample, the remaining samples are all
% separated by a factor of Q. Only training+data samples are kept.
r = mf(t_samp:Q:t_samp+Q*(nr_training_bits+nr_data_bits)/2-1);
% Phase estimation and correction.
phihat = phase_estimation(r, b_train);
r = r * exp(-j*phihat);
% Make decisions. Note that dhat will include training sequence bits
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -