ELCT 562_CA5

docx

School

Clemson University *

*We aren’t endorsed by this school

Course

562

Subject

Electrical Engineering

Date

Apr 3, 2024

Type

docx

Pages

4

Uploaded by MateMonkey7318

Report
ELCT 562 Wireless Communications Computer Assignment #5 Task 1 (Receiver, 60 pts): 1) Develop a function that converts received IQ data to the data symbols by filling in the function below. You can add more input arguments if necessary. function [symbolsRX] = myReceiver(IQdata, prx) %%%%%%% fill here end In Appendix*** Task 2 (BER analysis, 40 pts): By using your receiver: 1) Simulate the BER for antipodal signaling by using your transmitter & receiver for 𝐸𝐸𝑠𝑠 𝑁𝑁 0 [0, 10] [dB]. 2) Show that the curve that you obtain matches with the corresponding theoretical curve. The y-axis should be given in logscale while x-axis is in dB scale (i.e., semilogy(x,y), not plot(x,y)).
The following program was generated to create a receiver that takes the received IQ data and processes it, converting it to data symbols. This information is than used to simulate the Bit Error Rate for antipodal signaling by referencing the transmitter and receiver. The key concepts of this program was to generate random bits using the randi function. These bits are then mapped to BPSK (Binary Phase-shift Keying) symbols and used a RRC filter to shape the bits. The AWGN channel is simulated and the receiver applied a matching filter and down sample to recover the symbols. The number of bit errors is calculated and the BER is produced for each energy per symbol. To compare the theoretical BER for BPSK the following function is used to calculate the probability of error: Q ( 2 E s N 0 ) This function is used to calculate the tail probably of the Gaussian distribution used in AWGN which plays a large role in SNR and decision thresholds and error probabilities. Overall, when comparing the theoretical Bit Error Rate and Simulated BER for the AWGN channel you can see little to no differences between the two, therefore creating a successful simulation.
Appendix: MATLAB Code: clear all close all clc %% Design and simulation parameters for millimeter wave communications: rho = 0.2; fsample = 2e9; % 2 GHz Tsample = 1/fsample; Tspacing = 2e-9; % 2 ns EsN0dBlist = [0:10]; % SNR in dB N = 100000; Nover = Tspacing/Tsample; %% This is an example of generating IQdatatx from 10 random bits if (1) N = 10; % number of bits bitsTX = randi([0 1],N,1); % random bits symbolsTX = 2*bitsTX-1; % (i.e., the alphabet is {1,-1}) [IQdataTX pTX] = myWaveform(rho, symbolsTX, Tsample, Tspacing); figure(1); plot(real(IQdataTX), 'displayname' , 'In-phase' ); hold on title( 'Signal in time (in-phase)' ) figure(2); stem((pTX), 'displayname' , 'p_{tx}[n]' ) title( 'Transmit filter (or pulse shape)' ) end %%%%%%%%%%%%%%%%%%%%%%%%%HOMEWORK%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% BER analysis for various Es/N0 points if (1) numberOfErrorsList = zeros(size(EsN0dBlist)); for indEsN0dB = 1:numel(EsN0dBlist) bitsTX = randi([0, 1], N, 1); symbolsTX = 2*bitsTX - 1; [IQdataTX, pTX] = myWaveform(rho, symbolsTX, Tsample, Tspacing); EsN0 = 10^(EsN0dBlist(indEsN0dB)/10); N0 = 1/EsN0; noiseVariance = N0/2; noise = sqrt(noiseVariance) * (randn(size(IQdataTX)) + 1i * randn(size(IQdataTX))); IQdataRX = IQdataTX + noise; symbolsRX = myReceiver(IQdataRX, pTX, Nover, N); errors = sum(bitsTX ~= symbolsRX); numberOfErrorsList(indEsN0dB) = errors; end %% Calculate and Plot BER BERlist = numberOfErrorsList / N; % BER calculation BERlistTheory = qfunc(sqrt(2 * 10.^(EsN0dBlist / 10))); % Theoretical BER % Plotting BER Performance figure;
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
semilogy(EsN0dBlist, BERlist, 'b-o' , 'DisplayName' , 'Simulated BER' ); hold on ; semilogy(EsN0dBlist, BERlistTheory, 'r--' , 'DisplayName' , 'Theoretical BER' ); xlabel( 'E_s/N_0 (dB)' ); ylabel( 'BER' ); title( 'BER Performance of BPSK in AWGN' ); legend( 'Location' , 'best' ); grid on ; figure(2); plot(real(IQdataTX), 'DisplayName' , 'In-phase Component' ); title( 'Signal in Time (In-phase Component)' ); xlabel( 'Sample Index' ); ylabel( 'Amplitude' ); legend show ; grid on ; figure(3); stem(pTX, 'DisplayName' , 'Transmit Pulse Shape' ); title( 'Transmit Filter (or Pulse Shape)' ); xlabel( 'Sample Index' ); ylabel( 'Amplitude' ); legend show ; grid on ; end function [symbolsRX] = myReceiver(IQdata, prx, Nover, symbolsLength) rxFiltered = conv(IQdata, conj(fliplr(prx)), 'same' ); filterDelay = (length(prx) - 1) / 2; startIndex = 1 + filterDelay; symbolsRX = rxFiltered(startIndex:Nover:startIndex+Nover*(symbolsLength-1)); symbolsRX = real(symbolsRX) > 0; end %%%%%%%%%%%%%%%%%%%%%%%%%HOMEWORK%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [IQdata ptx] = myWaveform(rho, symbols, Tsample, Tspacing) Nover = Tspacing/Tsample; n = [-10:1/Nover:10]; h = rrc(rho,n); h = h/sqrt(sum(abs(h).^2)); symbolsUp = upsample(symbols,Nover); IQdata = conv(h,symbolsUp); ptx = h; end function h = rrc(beta,t) h = (sin((1-beta)*pi*t)+4*beta*t.*cos((1+beta)*pi*t))./ (pi*t.*(1- (4*beta*t).^2)); h(t==0) = 1 - beta*(1 - (4/pi)); h(t == 1/4/beta | t == -1/4/beta) = beta/sqrt(2)*((1+2/pi) * sin(pi/(4*beta)) + (1-2/pi) * cos(pi/(4*beta))); end