Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Simple problem QAM (BER v EbNo graph), please help..

Status
Not open for further replies.

mjh

Newbie level 1
Joined
Mar 26, 2008
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,298
qam ber

Hi,
I am simulating a QAM modulation for 2,4,16 & 64 QAM and want to produce the BER v EbNo graph for a noisy signal in order to compare to the theoretical value I have. i know this is relatively easy, but I'm not sure how to/the best way to do this. The basis of my code is below, so if someone could help with the relevant section (or be able to send me any QAM code you have..) i would greatly appreciate it, thanks... mjh


% Variables & parameters:
global M % Sets M as a global variable
global ynoise
bps=log2(M) % No. of bits per symbol
n = 30000; % No. of bits to process
Fd=1;Fs=1; % Sampling freq (input;output)
nsamp=1; % Oversampling rate
J= sqrt(-1); % To represent imag component J

% Generate signal with noise:
x = randint(n,1); % To create a random binary stream
xsym = bi2de(reshape(x,bps,length(x)/bps).','left-msb'); % Convert the bits in x into k-bit symbols.
y = dmodce(xsym,Fd,Fs, 'qask',M); % Modulate for M-QAM
ytx = y; % Transmitted signal
% Signal over AWGN channel
EbNo = 10; % NB: in dB
snr = EbNo + 10*log10(bps) - 10*log10(nsamp);
ynoise = awgn(ytx,snr,'measured');
%ynoise = awgn(y,(M-1)); % Transmit signal through an AWGN channel.
yrx = ynoise; % Received Signal

% BER:
figure; % To open new figure
% Theoretical BER curve, Pe...
xfunc = sqrt((3/(n^2-1)*EbNo)); % Set variable 'xfunc' = sqrt(2*(y)) to use in Pe equation..
Pe = (2*(1-(1/n))*erfc(xfunc)); % Calculate Pe

% **********#### Calculate BER for various EbNo values ###*************
% <insert code here..>

% Plot graph comparing theoretical BER with actual:
semilogy(y, Pe, '-r*');
legend('Theorerical (Pe)'); % Legend for graph
xlabel('Eb/No'); % Label for x-axis
ylabel('BER'); % Label for y-axis
% **********###--------------------------------####***********************

end
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top