
实现信道仅有噪声的整个通信流程的demo也可以加入频偏相偏clearclc%% 实现信道仅有噪声的整个通信流程的demo也可以加入频偏相偏% Set the example parameters.fs 10e6; % Sample rate (Hz)sps 4; % Samples per symbolM 16; % Modulation order, 16QAM调制k log2(M); % Bits per symbol% Convert the Eb/N0 to SNR and then pass the signal through an AWGN channel.EbNo 7;snr EbNo 10log10(k) - 10log10(sps);rolloff 0.35;span 6;% rrcFilter genRRCfilter(rolloff, span, sps); % 重构的构造根升余弦滤波器代码rrcFilter rcosdesign(rolloff, span, sps);phaseFreqOffset comm.PhaseFrequencyOffset(…‘FrequencyOffset’,400,…‘PhaseOffset’,30,…‘SampleRate’,fs);data randi([0 M-1],10000,1);modSig qammod(data,M);xcomplex(zeros(length(modSig)*sps - (sps-1),1));% - (sps-1) 是因为最后一个符号不用再插值了只插在中间x(1:sps:end)modSig(1:end);txSig conv(x,rrcFilter); % y即txSig% freqOffsetSig phaseFreqOffset(txSig);rxSig awgn(txSig, snr, ‘measured’);% Filter and downsample the received signal. Remove a portion of the signal to account for the filter delay.rxFilt upfirdn(rxSig, rrcFilter, 1, sps);rxFilt rxFilt(span1:end-span);scatterplot(rxSig)scatterplot(rxFilt)