⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decoding_coherent_test.m

📁 source Matlab traites the UWB
💻 M
字号:
%%clear all;%% Necessary pathaddpath ../addpath ../rng;addpath ../util;addpath ../pulse;addpath ../receiver;addpath ../data_signal;% Some parametersFS_CONT = 8e9;PACKET_LENGTH = 128*8;TC = 2e-9;Eb = 1;snr_dB = 5:1:15;% ReceiverT_INT = 1e-9;N_INT = 1;% From SNR in dB to the variance of the noisesnr = 10.^(snr_dB/10);s2 = Eb ./ (2*snr);% SimulationL = 200;dt = 1/FS_CONT;%samples_per_unit = 1e-9*FS_CONT;samples_per_unit = 1e-9*FS_CONT;samples_per_chip = TC * FS_CONT;% Get a pulsechip_span = 0.5;[monopulse,t] = get_monopulse(1,chip_span,1e-9,TC,samples_per_chip);monopulse = monopulse(1:end-1);% Normalizemonopulse = Eb*monopulse./norm(monopulse);% $$$ % Better?% $$$ monopulse = Eb*monopulse/sqrt(dt*sum(monopulse.^2));% Create the signal to be transmittedtx_signal = conv(monopulse,upsample(ones(1,PACKET_LENGTH),2*samples_per_chip));tx_signal = tx_signal(1:2*PACKET_LENGTH*samples_per_chip);% Indices for the energy receiversignal_start_0 = cumsum(ones(1,PACKET_LENGTH)*(2*samples_per_chip))-(2* ...						  samples_per_chip);% Coherent receiver and decoding;template = repmat(monopulse,1,PACKET_LENGTH);n = length(monopulse);signal_idx_0 = repmat(signal_start_0,n,1)+repmat((0:n-1)',1,PACKET_LENGTH) + 1;signal_idx_1 = signal_idx_0 + samples_per_chip;% Parameters for the generation of the Gaussian noiseALPHA = PACKET_LENGTH;T     = TC;Nt    = T*FS_CONT;B     = 1e9;Scale = (2*B)/FS_CONT;;for l = 1:length(snr_dB)  fprintf('SNR = %d [dB]\n',snr_dB(l));  for k = 1:L    % Add the noise% $$$     noise = ...% $$$     sqrt(s2(l))*randn(1,PACKET_LENGTH*2*samples_per_chip);    [noise_0 noise_1] = ...    randn_bl(ALPHA,T,Nt,B,s2(l)*Scale);    rx_signal = tx_signal + [noise_0 noise_1];    % Coherent receiver    rx_0 = coherent_receiver( ...        rx_signal(reshape(signal_idx_0,1, PACKET_LENGTH*n)),n,template);    rx_1 = coherent_receiver( ...        rx_signal(reshape(signal_idx_1,1, PACKET_LENGTH*n)),n,template);    rx_down = rx_0-rx_1;    idx_dec0 = find(rx_down>0);    idx_dec1 = find(rx_down<0);    idx_unknown = find(rx_down==0);    decoded = [];    decoded(idx_dec0) = 0;    decoded(idx_dec1) = 1;    decoded(idx_unknown) = round(rand(1,length(idx_unknown)));    % Compute the BER    [num_err,ber_sim(l,k)] = symerr(decoded,zeros(1,PACKET_LENGTH));    endendsemilogy(snr_dB,mean(ber_sim,2),'.');% Achtung, orthogonal modulation schemeber_bppm = 0.5*erfc( sqrt(snr) / sqrt(2));ber_bpsk = 0.5*erfc( sqrt(2*snr) / sqrt(2));hold on;semilogy(snr_dB,ber_bppm,'r',snr_dB,ber_bpsk,'r--');hold off;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -